Skip to content

Commit

Permalink
make a separate skosmos configuration for testing base href as it oth…
Browse files Browse the repository at this point in the history
…erwise interferes with cypress testing
  • Loading branch information
osma committed Sep 1, 2023
1 parent 9bfc68f commit 04949b0
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = defineConfig({
projectRoot: "tests",
e2e: {
// You also can run like this: npx cypress run --config "baseUrl=http://localhost/Skosmos"
baseUrl: 'http://localhost/Skosmos',
baseUrl: 'http://localhost:9090/',
setupNodeEvents(on, config) {
on('task', {
log(message) {
Expand Down
5 changes: 4 additions & 1 deletion tests/GlobalConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ class GlobalConfigTest extends PHPUnit\Framework\TestCase
private $config;
/** @var GlobalConfig */
private $configWithDefaults;
/** @var GlobalConfig */
private $configWithBaseHref;

protected function setUp(): void
{
$this->config = new GlobalConfig('/../../tests/testconfig.ttl');
$this->assertNotNull($this->config->getCache());
$this->assertNotNull($this->config->getGraph());
$this->configWithDefaults = new GlobalConfig('/../../tests/testconfig-fordefaults.ttl');
$this->configWithBaseHref = new GlobalConfig('/../../tests/testconfig-basehref.ttl');
}

// --- tests for values that are overriding default values
Expand Down Expand Up @@ -53,7 +56,7 @@ public function testGetServiceName()

public function testGetBaseHref()
{
$this->assertEquals("http://tests.localhost/Skosmos/", $this->config->getBaseHref());
$this->assertEquals("http://tests.localhost/Skosmos/", $this->configWithBaseHref->getBaseHref());
}

public function testGetLanguages()
Expand Down
2 changes: 1 addition & 1 deletion tests/RestControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ public function testVocabularyStatistics()
},
"count": "void:entities",
"@language": "en",
"@base": "http://tests.localhost/Skosmos/rest/v1/test/"
"@base": "http://:/rest/v1/test/"
},
"uri": "",
"id": "test",
Expand Down
52 changes: 52 additions & 0 deletions tests/testconfig-basehref.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@prefix void: <http://rdfs.org/ns/void#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix wv: <http://vocab.org/waiver/terms/norms> .
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@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 : <http://base/#> .

# Skosmos main configuration

:config a skosmos:Configuration ;
# customize the base element. Set this if the automatic base url detection doesn't work. For example setups behind a proxy.
skosmos:baseHref "http://tests.localhost/Skosmos/" ;
skosmos:templateCache "/tmp/skosmos-template-cache-tests" .

:test a skosmos:Vocabulary, void:Dataset ;
dc:title "Test ontology"@en ;
dc:subject :cat_science ;
dc:type mdrtype:ONTOLOGY ;
void:dataDump <http://skosmos.skos/dump/test/> ;
void:sparqlEndpoint <http://localhost:13030/skosmos-test/sparql> ;
void:uriSpace "http://www.skosmos.skos/test/";
skos:prefLabel "Test ontology"@en ;
skosmos:arrayClass isothes:ThesaurusArray ;
skosmos:defaultLanguage "en";
skosmos:feedbackRecipient "[email protected]";
skosmos:groupClass skos:Collection;
skosmos:language "en";
skosmos:showTopConcepts "true";
skosmos:shortName "Test short",
"Testi lyhyt"@fi;
skosmos:sparqlGraph <http://www.skosmos.skos/test/> .

:cat_science a skos:Concept ;
skos:topConceptOf :categories ;
skos:inScheme :categories ;
skos:prefLabel "Luonnontieteet ja lääketiede"@fi,
"Naturvetenskap och medicin"@sv,
"Science and medicine"@en .

mdrtype:THESAURUS a skos:Concept ;
skos:prefLabel "Тезаурус"@bg, "Tezaurus"@cs, "Tesaurus"@da, "Thesaurus"@de, "Θησαυρός"@el, "Thesaurus"@en, "Tesaurus"@et, "Tesaurus"@fi, "Thésaurus"@fr, "Pojmovnik"@hr, "Tezaurusz"@hu, "Tesauro"@it, "Tēzaurs"@lv, "Tezauras"@lt, "Teżawru"@mt, "Thesaurus"@nl, "Tesaurus"@no, "Tezaurus"@pl, "Tesauro"@pt, "Tezaur"@ro, "Synonymický slovník"@sk, "Tezaver"@sl, "Tesauro"@es, "Tesaurus"@sv .

mdrtype:ONTOLOGY a skos:Concept ;
skos:prefLabel "Онтология"@bg, "Ontologie"@cs, "Ontologi"@da, "Ontologie"@de, "Οντολογία"@el, "Ontology"@en, "Ontoloogia"@et, "Ontologia"@fi, "Ontologie"@fr, "Ontologija"@hr, "Ontológia"@hu, "Ontologia"@it, "Ontoloģija"@lv, "Ontologija"@lt, "Ontoloġija"@mt, "Ontologie"@nl, "Ontologi"@no, "Struktura pojęciowa"@pl, "Ontologia"@pt, "Ontologie"@ro, "Ontológia"@sk, "Ontologija"@sl, "Ontología"@es, "Ontologi"@sv .
2 changes: 1 addition & 1 deletion tests/testconfig.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# customize the service name
skosmos:serviceName "Skosmos being tested" ;
# customize the base element. Set this if the automatic base url detection doesn't work. For example setups behind a proxy.
skosmos:baseHref "http://tests.localhost/Skosmos/" ;
#skosmos:baseHref "http://localhost/Skosmos/" ;
# interface languages available, and the corresponding system locales
skosmos:languages ( [ rdfs:label "en" ; rdf:value "en_GB.utf8" ]
[ rdfs:label "fi" ; rdf:value "fi_FI.utf8" ]
Expand Down

0 comments on commit 04949b0

Please sign in to comment.