/** * Asserts that all the given tag ids exist. * * @param string[] $tagIds tag ids to check * * @throws \OCP\SystemTag\TagNotFoundException if at least one tag did not exist */ private function assertTagsExist($tagIds) { $tags = $this->tagManager->getTagsById($tagIds); if (count($tags) !== count($tagIds)) { // at least one tag missing, bail out $foundTagIds = array_map(function (ISystemTag $tag) { return $tag->getId(); }, $tags); $missingTagIds = array_diff($tagIds, $foundTagIds); throw new TagNotFoundException('Tags not found', 0, null, $missingTagIds); } }
/** * @expectedException \InvalidArgumentException */ public function testGetInvalidTagIdFormat() { $tag1 = $this->tagManager->createTag('one', true, false); $this->tagManager->getTagsById([$tag1->getId() . 'suffix']); }