コード例 #1
0
 public function testAssertMemberLocks()
 {
     $lock = new DAV_Element_activelock(array('lockroot' => '/collection/child/subresource', 'locktoken' => 'thelocktoken', 'owner' => '/path/to/user', 'timeout' => time() + 3600));
     $lockProviderStub = $this->getMock('DAV_Lock_Provider');
     $lockProviderStub->expects($this->atLeastOnce())->method('memberLocks')->with($this->equalTo('/collection/child'))->will($this->returnValue(array('thelocktoken' => $lock)));
     DAV::$LOCKPROVIDER = $lockProviderStub;
     DAV::$SUBMITTEDTOKENS['thelocktoken'] = 'thelocktoken';
     $obj = new DAVACL_Test_Collection('/collection/child');
     $obj->assertMemberLocks();
     // No need to assert anything; if the resource is locked (which it should not be), an exception will be thrown
     unset(DAV::$SUBMITTEDTOKENS['thelocktoken']);
     $this->setExpectedException('DAV_Status', '', 423);
     $obj->assertMemberLocks();
 }