Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #934 #946

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"grimmlink/qtip2": "3.0.3"
},
"require-dev": {
"phpunit/phpunit": "4.8 - 7.5.10",
"phpunit/phpunit": "7.2.0 - 7.5.20",
"umpirsky/twig-gettext-extractor": "1.3.*",
"symfony/dom-crawler": "3.4.3",
"mockery/mockery": "1.0"
Expand Down
4 changes: 4 additions & 0 deletions tests/FeedbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function testHoneypotFieldsGenerated() {
* @covers Honeypot::validateHoneytime
*/
public function testHoneypotAndHoneypot() {
$this->expectNotToPerformAssertions();
$this->request
->shouldReceive('getQueryParamPOST')
->with('message')
Expand Down Expand Up @@ -84,6 +85,7 @@ public function testHoneypotAndHoneypot() {
* @covers Honeypot::validateHoneytime
*/
public function testHoneypotAndHoneypotDisabled() {
$this->expectNotToPerformAssertions();
$this->controller->honeypot->disable();
$this->request
->shouldReceive('getQueryParamPOST')
Expand Down Expand Up @@ -126,6 +128,7 @@ public function testHoneypotAndHoneypotDisabled() {
* @covers Honeypot::validateHoneytime
*/
public function testHoneytimeTooFast() {
$this->expectNotToPerformAssertions();
$this->request
->shouldReceive('getQueryParamPOST')
->with('message')
Expand Down Expand Up @@ -165,6 +168,7 @@ public function testHoneytimeTooFast() {
* @covers Honeypot::validateHoneypot
*/
public function testHoneypotNotEmpty() {
$this->expectNotToPerformAssertions();
$this->request
->shouldReceive('getQueryParamPOST')
->with('message')
Expand Down
8 changes: 2 additions & 6 deletions tests/GlobalConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,16 @@ public function testGetGlobalPlugins()

// --- tests for the exception paths

/**
* @expectedException
*/
public function testInitializeConfigWithoutGraph()
{
$this->expectOutputString('Error: config.ttl must have exactly one skosmos:Configuration');
$conf = new GlobalConfig('/../tests/testconfig-nograph.ttl');
$this->assertNotNull($conf);
}

/**
* @expectedException
*/
public function testInexistentFile()
{
$this->expectOutputString('Error: config.ttl file is missing, please provide one.');
$conf = new GlobalConfig('/../tests/testconfig-idonotexist.ttl');
$this->assertNotNull($conf);
}
Expand Down
8 changes: 7 additions & 1 deletion tests/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testGetVocabularyCategories() {
* @covers Model::getVocabulariesInCategory
*/
public function testGetVocabulariesInCategory() {
$category = $this->model->getVocabulariesInCategory('cat_science');
$category = $this->model->getVocabulariesInCategory(new EasyRdf\Resource('http://base/#cat_science'));
foreach($category as $vocab)
$this->assertInstanceOf('Vocabulary', $vocab);
}
Expand Down Expand Up @@ -237,6 +237,12 @@ public function testSearchConceptsWithMultipleBroaders() {
$result = $this->model->searchConcepts($this->params);
$this->assertEquals('http://www.skosmos.skos/test/ta123', $result[0]['uri']);
$this->assertEquals('multiple broaders', $result[0]['prefLabel']);

// sort by URI to ensure their relative order
usort($result[0]['skos:broader'], function($a, $b) {
return strnatcasecmp($a['uri'], $b['uri']);
});

$this->assertCount(2, $result[0]['skos:broader']); // two broader concepts
$this->assertEquals('http://www.skosmos.skos/test/ta118', $result[0]['skos:broader'][0]['uri']);
$this->assertEquals('-"special" character \\example\\', $result[0]['skos:broader'][0]['prefLabel']);
Expand Down
4 changes: 4 additions & 0 deletions tests/RestControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ protected function setUp() {
$this->controller = new RestController($this->model);
}

protected function tearDown() {
ob_clean();
}

/**
* @covers RestController::data
*/
Expand Down
1 change: 0 additions & 1 deletion tests/VocabularyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ public function testGetConceptScheme() {
$vocab = $this->model->getVocabulary('http304');
$conceptSchemeUri = $vocab->getDefaultConceptScheme();
$conceptScheme = $vocab->getConceptScheme($conceptSchemeUri);
print($conceptSchemeUri);
$this->assertEquals(
"Test Main Concept Scheme",
$conceptScheme->getLiteral($conceptSchemeUri,"skos:prefLabel")
Expand Down
2 changes: 1 addition & 1 deletion tests/jenatestconfig.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@prefix meta: <http://www.skosmos.skos/test-meta/> .
@prefix my: <http://example.com/myns#> .
@prefix mdrtype: <http://publications.europa.eu/resource/authority/dataset-type/> .
@prefix : <#> .
@prefix : <http://base/#> .

# Skosmos main configuration

Expand Down
2 changes: 1 addition & 1 deletion tests/testconfig-fordefaults.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@prefix skosmos: <http://purl.org/net/skosmos#> .
@prefix isothes: <http://purl.org/iso25964/skos-thes#> .
@prefix mdrtype: <http://publications.europa.eu/resource/authority/dataset-type/> .
@prefix : <#> .
@prefix : <http://base/#> .

# Skosmos main configuration

Expand Down
2 changes: 1 addition & 1 deletion tests/testconfig.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@prefix my: <http://example.com/myns#> .
@prefix mdrtype: <http://publications.europa.eu/resource/authority/dataset-type/> .
@prefix test: <http://www.skosmos.skos/test/> .
@prefix : <#> .
@prefix : <http://base/#> .

# Skosmos main configuration

Expand Down