/** * @covers Vocabulary::getBreadCrumbs * @covers Vocabulary::combineCrumbs * @covers Vocabulary::getCrumbs */ public function testGetBreadCrumbsCycle() { $model = new Model(new GlobalConfig('/../tests/testconfig.inc')); $vocab = $model->getVocabulary('cycle'); $result = $vocab->getBreadCrumbs('en', 'http://www.skosmos.skos/cycle/ta4'); foreach ($result['breadcrumbs'][0] as $crumb) { $this->assertInstanceOf('Breadcrumb', $crumb); } }
/** * @covers Concept::getProperties * @covers Concept::getCollectionMembers * @covers ConceptProperty::getValues * @covers ConceptPropertyValue::getLabel * @covers ConceptPropertyValue::getSubMembers */ public function testGetPropertiesWithNarrowersPartOfACollection() { $model = new Model(new GlobalConfig('/../tests/testconfig.inc')); $vocab = $model->getVocabulary('groups'); $concept = $vocab->getConceptInfo("http://www.skosmos.skos/groups/ta1", "en"); $props = $concept[0]->getProperties(); $narrowers = $props['skos:narrower']->getValues(); $this->assertCount(3, $narrowers); foreach ($narrowers as $coll) { $subs = $coll->getSubMembers(); if ($coll->getLabel() === "Freshwater fish") { $this->assertArrayHasKey("Carp", $subs); } elseif ($coll->getLabel() === "Saltwater Fish") { $this->assertArrayHasKey("Flatfish", $subs); $this->assertArrayHasKey("Tuna", $subs); } elseif ($coll->getLabel() === "Submarine-like fish") { $this->assertArrayHasKey("Tuna", $subs); } } }
/** * @covers Model::getVocabulary * @depends testConstructorWithConfig * @expectedException \Exception * @expectedExceptionMessage Vocabulary id 'thisshouldnotbefound' not found in configuration */ public function testGetVocabularyByFalseId() { $model = new Model(new GlobalConfig('/../tests/testconfig.inc')); $vocab = $model->getVocabulary('thisshouldnotbefound'); $this->assertInstanceOf('Vocabulary', $vocab); }