public function testGetProperties() { $systemTag = new SystemTag(1, 'Test', true, true); $requestedProperties = [self::ID_PROPERTYNAME, self::DISPLAYNAME_PROPERTYNAME, self::USERVISIBLE_PROPERTYNAME, self::USERASSIGNABLE_PROPERTYNAME]; $expectedProperties = [200 => [self::ID_PROPERTYNAME => '1', self::DISPLAYNAME_PROPERTYNAME => 'Test', self::USERVISIBLE_PROPERTYNAME => 1, self::USERASSIGNABLE_PROPERTYNAME => 1]]; $node = $this->getMockBuilder('\\OCA\\DAV\\SystemTag\\SystemTagNode')->disableOriginalConstructor()->getMock(); $node->expects($this->any())->method('getSystemTag')->will($this->returnValue($systemTag)); $this->tree->expects($this->any())->method('getNodeForPath')->with('/systemtag/1')->will($this->returnValue($node)); $propFind = new \Sabre\DAV\PropFind('/systemtag/1', $requestedProperties, 0); $this->plugin->handleGetProperties($propFind, $node); $result = $propFind->getResultForMultiStatus(); $this->assertEmpty($result[404]); unset($result[404]); $this->assertEquals($expectedProperties, $result); }
/** * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testGetPropertiesForbidden() { $systemTag = new SystemTag(1, 'Test', true, false); $requestedProperties = [self::ID_PROPERTYNAME, self::GROUPS_PROPERTYNAME]; $this->user->expects($this->once())->method('getUID')->willReturn('admin'); $this->groupManager->expects($this->once())->method('isAdmin')->with('admin')->willReturn(false); $node = $this->getMockBuilder('\\OCA\\DAV\\SystemTag\\SystemTagNode')->disableOriginalConstructor()->getMock(); $node->expects($this->any())->method('getSystemTag')->will($this->returnValue($systemTag)); $this->tree->expects($this->any())->method('getNodeForPath')->with('/systemtag/1')->will($this->returnValue($node)); $propFind = new \Sabre\DAV\PropFind('/systemtag/1', $requestedProperties, 0); $this->plugin->handleGetProperties($propFind, $node); }