public function __construct($path) { parent::__construct($path); if ($path === '/path/to/resource/') { $this->children = array('subdir1/', 'subdir2/', 'subdir3/'); } elseif ($path === '/path/to/resource/subdir1/') { $this->children = array('subfile1', 'subfile2'); } }
public function testProp_resourcetype() { $this->assertNull($this->obj->prop_resourcetype(), 'DAV_Resource::prop_resourcetype() should return the correct value'); $stub = $this->getMock('DAV_Resource', array('user_prop_resourcetype'), array('/path')); $stub->expects($this->once())->method('user_prop_resourcetype')->will($this->returnValue('<D:unexisting_type/>')); $this->assertSame('<D:unexisting_type/>', $stub->prop_resourcetype(), 'DAV_Resource::prop_resourcetype() should return the value returned by DAV_Resource::user_prop_resourcetype()'); $collection = new DAVACL_Test_Collection('/path'); $principal = new DAVACL_Test_Principal('/path'); $this->assertSame(DAV_Collection::RESOURCETYPE, $collection->prop_resourcetype(), 'DAV_Resource::prop_resourcetype should indicate being a collection if DAV_Collection is implemented'); $this->assertSame(DAVACL_Principal::RESOURCETYPE, $principal->prop_resourcetype(), 'DAV_Resource::prop_resourcetype should indicate being a collection if DAVACL_Principal is implemented'); }