Skip to content

Commit

Permalink
added test for transforming concept counting
Browse files Browse the repository at this point in the history
  • Loading branch information
Vainonen committed Jun 2, 2021
1 parent 4cced04 commit faf465e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions model/Vocabulary.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ private function parseVersionInfo($version)
/**
* Counts the statistics of the vocabulary.
* @return Array containing the label counts
* @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray
* @param string $group the uri of the concept group class, eg. isothes:ConceptGroup
*/
public function getStatistics($lang = '', $array=null, $group=null)
{
Expand Down
2 changes: 2 additions & 0 deletions model/sparql/GenericSparql.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ private function transformCountConceptsResults($result, $lang) {
/**
* Used for counting number of concepts and collections in a vocabulary.
* @param string $lang language of labels
* @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray
* @param string $group the uri of the concept group class, eg. isothes:ConceptGroup
* @return array with number of concepts in this vocabulary per label
*/
public function countConcepts($lang = null, $array = null, $group = null) {
Expand Down
13 changes: 13 additions & 0 deletions tests/GenericSparqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ public function testCountConcepts() {
$this->assertEquals(17, $actual['http://www.w3.org/2004/02/skos/core#Concept']['count']);
}

/**
* @covers GenericSparql::countConcepts
* @covers GenericSparql::generateCountConceptsQuery
* @covers GenericSparql::transformCountConceptsResults
*/
public function testTransformCountConceptsResults() {
$result = $this->sparql->countConcepts();

$this->assertEquals(13, $result['http://www.skosmos.skos/test-meta/TestClass']['count']);
$this->assertEquals(1, $result['http://www.skosmos.skos/test-meta/TestClass']['deprecatedCount']);
$this->assertEquals('http://www.skosmos.skos/test-meta/TestClass', $result['http://www.skosmos.skos/test-meta/TestClass']['type']);
}

/**
* @covers GenericSparql::countLangConcepts
* @covers GenericSparql::generateCountLangConceptsQuery
Expand Down

0 comments on commit faf465e

Please sign in to comment.