ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\HttpMoveTest Class Reference

Tests related to the MOVE request. More...

+ Inheritance diagram for Sabre\DAV\HttpMoveTest:
+ Collaboration diagram for Sabre\DAV\HttpMoveTest:

Public Member Functions

 setUpTree ()
 Sets up the DAV tree. More...
 
 testMoveToSelf ()
 
 testMove ()
 
 testMoveToExisting ()
 
 testMoveToExistingOverwriteT ()
 
 testMoveToExistingOverwriteF ()
 
 testMoveToExistingBlockedDeleteSource ()
 If we MOVE to an existing file, but a plugin prevents the original from being deleted, we need to make sure that the server does not delete the destination. More...
 
- Public Member Functions inherited from Sabre\DAVServerTest
 setUp ()
 
 initializeEverything ()
 
 request ($request, $expectedStatus=null)
 Makes a request, and returns a response object. More...
 
 autoLogin ($userName)
 This function takes a username and sets the server in a state where this user is logged in, and no longer requires an authentication check. More...
 
 setUpTree ()
 Override this to provide your own Tree for your test-case. More...
 
 setUpBackends ()
 
 assertHttpStatus ($expectedStatus, HTTP\Request $req)
 

Additional Inherited Members

- Protected Attributes inherited from Sabre\DAVServerTest
 $setupCalDAV = false
 
 $setupCardDAV = false
 
 $setupACL = false
 
 $setupCalDAVSharing = false
 
 $setupCalDAVScheduling = false
 
 $setupCalDAVSubscriptions = false
 
 $setupCalDAVICSExport = false
 
 $setupLocks = false
 
 $setupFiles = false
 
 $setupSharing = false
 
 $setupPropertyStorage = false
 
 $caldavCalendars = []
 An array with calendars. More...
 
 $caldavCalendarObjects = []
 
 $carddavAddressBooks = []
 
 $carddavCards = []
 
 $server
 
 $tree = []
 
 $caldavBackend
 
 $carddavBackend
 
 $principalBackend
 
 $locksBackend
 
 $propertyStorageBackend
 
 $caldavPlugin
 
 $carddavPlugin
 
 $aclPlugin
 
 $caldavSharingPlugin
 
 $caldavSchedulePlugin
 
 $authPlugin
 
 $locksPlugin
 
 $sharingPlugin
 
 $propertyStoragePlugin
 
 $autoLogin = null
 If this string is set, we will automatically log in the user with this name. More...
 

Detailed Description

Tests related to the MOVE request.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 15 of file HttpMoveTest.php.

Member Function Documentation

◆ setUpTree()

Sabre\DAV\HttpMoveTest::setUpTree ( )

Sets up the DAV tree.

Returns
void

Definition at line 22 of file HttpMoveTest.php.

22  {
23 
24  $this->tree = new Mock\Collection('root', [
25  'file1' => 'content1',
26  'file2' => 'content2',
27  ]);
28 
29  }

◆ testMove()

Sabre\DAV\HttpMoveTest::testMove ( )

Definition at line 42 of file HttpMoveTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

42  {
43 
44  $request = new HTTP\Request('MOVE', '/file1', [
45  'Destination' => '/file3'
46  ]);
47  $response = $this->request($request);
48  $this->assertEquals(201, $response->getStatus(), print_r($response, true));
49  $this->assertEquals('content1', $this->tree->getChild('file3')->get());
50  $this->assertFalse($this->tree->childExists('file1'));
51 
52  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testMoveToExisting()

Sabre\DAV\HttpMoveTest::testMoveToExisting ( )

Definition at line 54 of file HttpMoveTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

54  {
55 
56  $request = new HTTP\Request('MOVE', '/file1', [
57  'Destination' => '/file2'
58  ]);
59  $response = $this->request($request);
60  $this->assertEquals(204, $response->getStatus(), print_r($response, true));
61  $this->assertEquals('content1', $this->tree->getChild('file2')->get());
62  $this->assertFalse($this->tree->childExists('file1'));
63 
64  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testMoveToExistingBlockedDeleteSource()

Sabre\DAV\HttpMoveTest::testMoveToExistingBlockedDeleteSource ( )

If we MOVE to an existing file, but a plugin prevents the original from being deleted, we need to make sure that the server does not delete the destination.

Definition at line 99 of file HttpMoveTest.php.

References $path, $request, $response, and Sabre\DAVServerTest\request().

99  {
100 
101  $this->server->on('beforeUnbind', function($path) {
102 
103  if ($path === 'file1') {
104  throw new \Sabre\DAV\Exception\Forbidden('uh oh');
105  }
106 
107  });
108  $request = new HTTP\Request('MOVE', '/file1', [
109  'Destination' => '/file2'
110  ]);
111  $response = $this->request($request);
112  $this->assertEquals(403, $response->getStatus(), print_r($response, true));
113  $this->assertEquals('content1', $this->tree->getChild('file1')->get());
114  $this->assertEquals('content2', $this->tree->getChild('file2')->get());
115  $this->assertTrue($this->tree->childExists('file1'));
116  $this->assertTrue($this->tree->childExists('file2'));
117 
118  }
$path
Definition: aliased.php:25
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testMoveToExistingOverwriteF()

Sabre\DAV\HttpMoveTest::testMoveToExistingOverwriteF ( )

Definition at line 79 of file HttpMoveTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

79  {
80 
81  $request = new HTTP\Request('MOVE', '/file1', [
82  'Destination' => '/file2',
83  'Overwrite' => 'F',
84  ]);
85  $response = $this->request($request);
86  $this->assertEquals(412, $response->getStatus(), print_r($response, true));
87  $this->assertEquals('content1', $this->tree->getChild('file1')->get());
88  $this->assertEquals('content2', $this->tree->getChild('file2')->get());
89  $this->assertTrue($this->tree->childExists('file1'));
90  $this->assertTrue($this->tree->childExists('file2'));
91 
92  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testMoveToExistingOverwriteT()

Sabre\DAV\HttpMoveTest::testMoveToExistingOverwriteT ( )

Definition at line 66 of file HttpMoveTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

66  {
67 
68  $request = new HTTP\Request('MOVE', '/file1', [
69  'Destination' => '/file2',
70  'Overwrite' => 'T',
71  ]);
72  $response = $this->request($request);
73  $this->assertEquals(204, $response->getStatus(), print_r($response, true));
74  $this->assertEquals('content1', $this->tree->getChild('file2')->get());
75  $this->assertFalse($this->tree->childExists('file1'));
76 
77  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testMoveToSelf()

Sabre\DAV\HttpMoveTest::testMoveToSelf ( )

Definition at line 31 of file HttpMoveTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

31  {
32 
33  $request = new HTTP\Request('MOVE', '/file1', [
34  'Destination' => '/file1'
35  ]);
36  $response = $this->request($request);
37  $this->assertEquals(403, $response->getStatus());
38  $this->assertEquals('content1', $this->tree->getChild('file1')->get());
39 
40  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: