xref: /plugin/davcal/vendor/sabre/dav/tests/Sabre/DAV/CopyTest.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\DAV;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehleruse Sabre\HTTP;
6*a1a3b679SAndreas Boehler
7*a1a3b679SAndreas Boehlerclass CopyTest extends \PHPUnit_Framework_TestCase {
8*a1a3b679SAndreas Boehler
9*a1a3b679SAndreas Boehler    public function setUp() {
10*a1a3b679SAndreas Boehler
11*a1a3b679SAndreas Boehler        \Sabre\TestUtil::clearTempDir();
12*a1a3b679SAndreas Boehler
13*a1a3b679SAndreas Boehler    }
14*a1a3b679SAndreas Boehler
15*a1a3b679SAndreas Boehler    /**
16*a1a3b679SAndreas Boehler     * This test makes sure that a path like /foo cannot be copied into a path
17*a1a3b679SAndreas Boehler     * like /foo/bar/
18*a1a3b679SAndreas Boehler     *
19*a1a3b679SAndreas Boehler     * @expectedException \Sabre\DAV\Exception\Conflict
20*a1a3b679SAndreas Boehler     */
21*a1a3b679SAndreas Boehler    public function testCopyIntoSubPath() {
22*a1a3b679SAndreas Boehler
23*a1a3b679SAndreas Boehler        $dir = new FS\Directory(SABRE_TEMPDIR);
24*a1a3b679SAndreas Boehler        $server = new Server($dir);
25*a1a3b679SAndreas Boehler
26*a1a3b679SAndreas Boehler        $dir->createDirectory('foo');
27*a1a3b679SAndreas Boehler
28*a1a3b679SAndreas Boehler        $request = new HTTP\Request('COPY','/foo', [
29*a1a3b679SAndreas Boehler            'Destination' => '/foo/bar',
30*a1a3b679SAndreas Boehler        ]);
31*a1a3b679SAndreas Boehler        $response = new HTTP\ResponseMock();
32*a1a3b679SAndreas Boehler
33*a1a3b679SAndreas Boehler        $server->invokeMethod($request, $response);
34*a1a3b679SAndreas Boehler
35*a1a3b679SAndreas Boehler    }
36*a1a3b679SAndreas Boehler
37*a1a3b679SAndreas Boehler}
38