public function setUp() { $properties = new PropertySet(); $properties['D:displayname'] = 'Example collection'; $properties->add(new DateTimeProperty('D:creationdate', '1997-12-01T17:42:21-08:00')); $properties->add(new ResourceType('collection')); $lockCapabilities = new SupportedLock(array('write' => array('exclusive', 'shared'))); $properties->add($lockCapabilities); $this->collection = new Resource('http://www.foo.bar/container/', $properties); $resourceProps = new PropertySet(); $resourceProps['D:displayname'] = 'Example HTML resource'; $resourceProps['D:getcontentlength'] = 4525; $resourceProps['D:getcontenttype'] = 'text/html'; $resourceProps['D:getcontentlanguage'] = 'en'; $resourceProps['D:getetag'] = 'zzyzx'; $resourceProps->add(new DateTimeProperty('D:creationdate', '1997-12-01T18:27:21-08:00')); $resourceProps->add(new DateTimeProperty('D:getlastmodified', 'Monday, 12-Jan-98 09:25:56 GMT')); $resourceProps->add(new ResourceType()); $resourceProps->add(new SupportedLock(array('write' => array('exclusive', 'shared')))); $this->lock = new Lock(); $this->lock->setDepth(-1); $this->lock->setTimeout(604800); $this->lock->setOwner('http://www.ics.uci.edu/~ejw/contact.html'); $this->lock->setToken('opaquelocktoken:e71d4fae-5dec-22d6-fea5-00a0c91e6be4'); $resourceProps->add(new LockDiscovery(array($this->lock))); $this->resource = new Resource('http://www.foo.bar/container/front.html', $resourceProps); }
public function setUp() { $lockOne = new Lock('shared'); $lockOne->setToken('opaquelocktoken:e71df4fae-5dec-22d6-fea5-00a0c91e6be4'); $lockTwo = new Lock('exclusive'); $lockTwo->setToken('opaquelocktoken:e71d4fae-5dec-22df-fea5-00a0c93bd5eb1'); $this->property = new LockDiscovery(array($lockOne, $lockTwo)); }
public function testReleaseLock() { $lock = new Lock(); $lock->setToken('opaquelocktoken:e71d4fae-5dec-22d6-fea5-00a0c91e6be4'); $this->client->expects($this->once())->method('createLock')->will($this->returnValue($lock)); $fd = fopen('webdav://www.foo.bar/front.html', 'w'); flock($fd, LOCK_EX); $this->client->expects($this->once())->method('releaseLock')->with($this->equalTo('http://www.foo.bar/front.html'), $this->equalTo($lock->getToken()))->will($this->returnValue(true)); $result = flock($fd, LOCK_UN); $this->assertTrue($result); }
public function testToken() { $this->lock->setToken('opaquelocktoken:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'); $this->assertEquals('opaquelocktoken:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', $this->lock->getToken()); }