/** * @expectedException Sabre\DAV\Exception\NotFound */ public function testDeleteTagNotFound() { // assuming the tag existed at the time the node was created, // but got deleted concurrently in the database $tag = new SystemTag(1, 'Test', true, true); $this->tagManager->expects($this->once())->method('canUserSeeTag')->with($tag)->will($this->returnValue($tag->isUserVisible())); $this->tagManager->expects($this->once())->method('canUserAssignTag')->with($tag)->will($this->returnValue($tag->isUserAssignable())); $this->tagMapper->expects($this->once())->method('unassignTags')->with(123, 'files', 1)->will($this->throwException(new TagNotFoundException())); $this->getMappingNode($tag)->delete(); }
public function testProcessFilterRulesVisibleTagAsUser() { $this->groupManager->expects($this->any())->method('isAdmin')->will($this->returnValue(false)); $tag1 = $this->getMock('\\OCP\\SystemTag\\ISystemTag'); $tag1->expects($this->any())->method('getId')->will($this->returnValue('123')); $tag1->expects($this->any())->method('isUserVisible')->will($this->returnValue(true)); $tag2 = $this->getMock('\\OCP\\SystemTag\\ISystemTag'); $tag2->expects($this->any())->method('getId')->will($this->returnValue('123')); $tag2->expects($this->any())->method('isUserVisible')->will($this->returnValue(true)); $this->tagManager->expects($this->once())->method('getTagsByIds')->with(['123', '456'])->will($this->returnValue([$tag1, $tag2])); $this->tagMapper->expects($this->at(0))->method('getObjectIdsForTags')->with('123')->will($this->returnValue(['111', '222'])); $this->tagMapper->expects($this->at(1))->method('getObjectIdsForTags')->with('456')->will($this->returnValue(['222', '333'])); $rules = [['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'], ['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456']]; $this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules]))); }
/** * @expectedException Sabre\DAV\Exception\NotFound */ public function testDeleteTagNotFound() { $this->tagMapper->expects($this->once())->method('unassignTags')->with(123, 'files', 1)->will($this->throwException(new TagNotFoundException())); $this->node->delete(); }
/** * @expectedException Sabre\DAV\Exception\BadRequest */ public function testChildExistsInvalidId() { $this->tagMapper->expects($this->once())->method('haveTag')->with([111], 'files', '555')->will($this->throwException(new \InvalidArgumentException())); $this->getNode()->childExists('555'); }