ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Plugin2Test.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\DAV\Locks;
4
6
8
9 public $setupLocks = true;
10
11 function setUpTree() {
12
13 $this->tree = new \Sabre\DAV\FS\Directory(SABRE_TEMPDIR);
14
15 }
16
17 function tearDown() {
18
20
21 }
22
32
33 $body = '<?xml version="1.0"?>
34<D:lockinfo xmlns:D="DAV:">
35 <D:lockscope><D:exclusive/></D:lockscope>
36 <D:locktype><D:write/></D:locktype>
37</D:lockinfo>';
38
39 $request = new Request(
40 'LOCK',
41 '/file.txt',
42 [],
43 $body
44 );
45 $response = $this->request($request);
46 $this->assertEquals(201, $response->getStatus(), $response->getBodyAsString());
47
48 $this->assertEquals(
49 1,
50 count($this->locksBackend->getLocks('file.txt', true))
51 );
52
53 $request = new Request(
54 'DELETE',
55 '/file.txt',
56 [
57 'If' => '(' . $response->getHeader('Lock-Token') . ')',
58 ]
59 );
60 $response = $this->request($request);
61 $this->assertEquals(204, $response->getStatus(), $response->getBodyAsString());
62
63 $this->assertEquals(
64 0,
65 count($this->locksBackend->getLocks('file.txt', true))
66 );
67 }
68
69}
foreach($paths as $path) $request
Definition: asyncclient.php:32
An exception for terminatinating execution or to throw for unit testing.
This class may be used as a basis for other webdav-related unittests.
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
setUpTree()
Override this to provide your own Tree for your test-case.
Definition: Plugin2Test.php:11
testUnlockAfterDelete()
This test first creates a file with LOCK and then deletes it.
Definition: Plugin2Test.php:31
The Request class represents a single HTTP request.
Definition: Request.php:18
static clearTempDir()
This function deletes all the contents of the temporary directory.
Definition: TestUtil.php:12
$response