From 1251f0cf9be366f5b4f73cd3da95dcefeba94d42 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:04:07 +0300 Subject: [PATCH 01/42] Remove Travis CI configuration file (not needed for GitHub Actions) --- .travis.yml | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9a9b50b64..000000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -sudo: required -dist: trusty -language: php -php: - - 7.2 - - 7.3 - - 7.4 -install: - - phpenv config-rm xdebug.ini - - composer install -cache: - directories: - - $HOME/.composer - - vendor -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - - cd tests - - export LANGUAGE=fr - - sh ./init_fuseki.sh - - cd .. -script: - - phpdbg -qrr vendor/bin/phpunit -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT - - bash <(curl -s https://codecov.io/bash) - - pkill -f 'java -Xmx1200M -jar' -env: - global: - - CC_TEST_REPORTER_ID=fb98170a5c7ea9cc2bbab19ff26268335e6a11a4f8267ca935e5e8ff4624886c - matrix: - - FUSEKI_VERSION=3.14.0 -matrix: - exclude: - allow_failures: -notifications: - slack: kansalliskirjasto:9mOKu3Vws1CIddF5jqWgXbli From f44f46bd59cba5e68d997a21f7698a53e678b144 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:06:09 +0300 Subject: [PATCH 02/42] add barebones GitHub Actions CI configuration --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..a56e08a37 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,14 @@ +name: CI + +on: [push] + +jobs: + build-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: php-actions/composer@v5 + + - uses: php-actions/phpunit@v2 From d6d846a8acb2a9d4f783e437944ddefc4bb7d211 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:10:58 +0300 Subject: [PATCH 03/42] Add required PHP extensions --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a56e08a37..8f74020a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,4 +11,7 @@ jobs: - uses: php-actions/composer@v5 - - uses: php-actions/phpunit@v2 + - name: PHPUnit tests + uses: php-actions/phpunit@v2 + with: + php_extensions: gettext intl xsl From ee6f13b748e0666c8d7740f1c1b5ec91bf6d5b0a Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:13:41 +0300 Subject: [PATCH 04/42] Declare PHP extensions already for Composer step --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f74020a4..8cd8a4a5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,9 +9,11 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: php-actions/composer@v5 - - - name: PHPUnit tests - uses: php-actions/phpunit@v2 + - name: Install Composer dependencies + uses: php-actions/composer@v5 with: + php_version: 7.4 php_extensions: gettext intl xsl + + - name: Run PHPUnit tests + uses: php-actions/phpunit@v2 From 1c15140c378e691aa93e2ae853f3bb3056246887 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:33:10 +0300 Subject: [PATCH 05/42] Try to install Fuseki under GH Actions --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cd8a4a5b..fbfebd5d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,11 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up Fuseki + run: | + cd tests + sh ./init_fuseki.sh + - name: Install Composer dependencies uses: php-actions/composer@v5 with: From 6a4c4210f1793084ef52efe41f3299e3a6259c03 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:37:20 +0300 Subject: [PATCH 06/42] Use PHPUnit 8.5.x under GH Actions --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbfebd5d8..205fbfbc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,3 +22,5 @@ jobs: - name: Run PHPUnit tests uses: php-actions/phpunit@v2 + with: + version: 8.5 From c902687dd0a12a32e68801b434f0630b5e62acf3 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:39:22 +0300 Subject: [PATCH 07/42] specify PHP version & extensions also for PHPUnit step --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 205fbfbc3..849983641 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,3 +24,5 @@ jobs: uses: php-actions/phpunit@v2 with: version: 8.5 + php_version: 7.4 + php_extensions: gettext intl xsl From 8b44e407aa4693c411940da9bcd188d941705c55 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:40:16 +0300 Subject: [PATCH 08/42] add --quiet option to fuseki wget command, to avoid spamming output --- tests/init_fuseki.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/init_fuseki.sh b/tests/init_fuseki.sh index 0d68541ad..9a89bf889 100755 --- a/tests/init_fuseki.sh +++ b/tests/init_fuseki.sh @@ -15,7 +15,7 @@ fi if [ ! -f "apache-jena-fuseki-$FUSEKI_VERSION/fuseki-server" ]; then echo "fuseki server file not found - downloading it" - wget --output-document=fuseki-dist.tar.gz "$fusekiurl" + wget --quiet --output-document=fuseki-dist.tar.gz "$fusekiurl" tar -zxvf fuseki-dist.tar.gz fi From e750e6e800435ec3543b8465f215f481832cd6de Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:41:02 +0300 Subject: [PATCH 09/42] Use wget in non-verbose mode, so errors are still printed (instead of totally quiet) --- tests/init_fuseki.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/init_fuseki.sh b/tests/init_fuseki.sh index 9a89bf889..4a6c39bed 100755 --- a/tests/init_fuseki.sh +++ b/tests/init_fuseki.sh @@ -15,7 +15,7 @@ fi if [ ! -f "apache-jena-fuseki-$FUSEKI_VERSION/fuseki-server" ]; then echo "fuseki server file not found - downloading it" - wget --quiet --output-document=fuseki-dist.tar.gz "$fusekiurl" + wget --no-verbose --output-document=fuseki-dist.tar.gz "$fusekiurl" tar -zxvf fuseki-dist.tar.gz fi From 986621362eb18c83c40c04d9280c95e5260ccdf0 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 12:43:52 +0300 Subject: [PATCH 10/42] reduce verbosity of tar command that uncompresses fuseki --- tests/init_fuseki.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/init_fuseki.sh b/tests/init_fuseki.sh index 4a6c39bed..cb9241e50 100755 --- a/tests/init_fuseki.sh +++ b/tests/init_fuseki.sh @@ -16,7 +16,8 @@ fi if [ ! -f "apache-jena-fuseki-$FUSEKI_VERSION/fuseki-server" ]; then echo "fuseki server file not found - downloading it" wget --no-verbose --output-document=fuseki-dist.tar.gz "$fusekiurl" - tar -zxvf fuseki-dist.tar.gz + echo "uncompressing fuseki distribution" + tar -zxf fuseki-dist.tar.gz fi cd "apache-jena-fuseki-$FUSEKI_VERSION" From e0558f59561095903c57e03c24be9a2196a1faef Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 14:20:21 +0300 Subject: [PATCH 11/42] Use Fuseki as a service container --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 849983641..e63488153 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,14 +6,14 @@ jobs: build-test: runs-on: ubuntu-latest + services: + fuseki: + image: stain/jena-fuseki + ports: 13030:3030 + steps: - uses: actions/checkout@v2 - - name: Set up Fuseki - run: | - cd tests - sh ./init_fuseki.sh - - name: Install Composer dependencies uses: php-actions/composer@v5 with: From 85b896260937b0f133fe83eb1753828a2153a46f Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 14:25:12 +0300 Subject: [PATCH 12/42] fix ci.yml syntax --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e63488153..9b03a4cfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,8 @@ jobs: services: fuseki: image: stain/jena-fuseki - ports: 13030:3030 + ports: + - 13030:3030 steps: - uses: actions/checkout@v2 From 75b49fa7ce9b22d23c04a1523d5c2b121795a585 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 14:46:57 +0300 Subject: [PATCH 13/42] Add test script/command to composer.json for use by CI action --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 2354c2830..3f8c88d85 100644 --- a/composer.json +++ b/composer.json @@ -87,5 +87,8 @@ }, "autoload": { "classmap": ["controller/", "model/", "model/sparql/"] + }, + "scripts": { + "test": "vendor/bin/phpunit" } } From d1fd2b6bdf0d0a13913924dc1742120fc069ec6f Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 14:47:52 +0300 Subject: [PATCH 14/42] avoid using container based php-actions --- .github/workflows/ci.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b03a4cfd..b16077d00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,16 +14,21 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Install Composer dependencies - uses: php-actions/composer@v5 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 with: - php_version: 7.4 - php_extensions: gettext intl xsl + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress - name: Run PHPUnit tests - uses: php-actions/phpunit@v2 - with: - version: 8.5 - php_version: 7.4 - php_extensions: gettext intl xsl + run: composer run-script test From a484aae0a1d8f2f070f0b8fdcb91cdac5eefbfc3 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 May 2021 14:49:40 +0300 Subject: [PATCH 15/42] drop strict composer validation as it won't pass anyway --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b16077d00..262eccd19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Validate composer.json and composer.lock - run: composer validate --strict - - name: Cache Composer packages id: composer-cache uses: actions/cache@v2 From 701c1f23b96e015b698242373dbc29c4d27cbb4f Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 10:39:54 +0300 Subject: [PATCH 16/42] Support setting SPARQL endpoint URL via environment variable --- model/GlobalConfig.php | 2 ++ model/Vocabulary.php | 9 +++++++- tests/GenericSparqlTest.php | 43 ++++++++++++++++++------------------ tests/GlobalConfigTest.php | 2 +- tests/JenaTextSparqlTest.php | 11 ++++----- tests/jenatestconfig.ttl | 25 ++------------------- tests/testconfig.ttl | 36 ++---------------------------- 7 files changed, 43 insertions(+), 85 deletions(-) diff --git a/model/GlobalConfig.php b/model/GlobalConfig.php index fedaa39dc..7a1719262 100644 --- a/model/GlobalConfig.php +++ b/model/GlobalConfig.php @@ -189,6 +189,8 @@ public function getDefaultEndpoint() $endpoint = $this->resource->get('skosmos:sparqlEndpoint'); if ($endpoint) { return $endpoint->getUri(); + } elseif (getenv('SKOSMOS_SPARQL_ENDPOINT')) { + return getenv('SKOSMOS_SPARQL_ENDPOINT'); } else { return 'http://localhost:3030/ds/sparql'; } diff --git a/model/Vocabulary.php b/model/Vocabulary.php index 2aaf4de7a..ade6023f6 100644 --- a/model/Vocabulary.php +++ b/model/Vocabulary.php @@ -31,7 +31,14 @@ public function getConfig() */ public function getEndpoint() { - return $this->resource->get('void:sparqlEndpoint')->getUri(); + $endpoint = $this->resource->get('void:sparqlEndpoint'); + if ($endpoint) { + return $endpoint->getUri(); + } elseif (getenv('SKOSMOS_SPARQL_ENDPOINT')) { + return getenv('SKOSMOS_SPARQL_ENDPOINT'); + } else { + return 'http://localhost:3030/ds/sparql'; + } } /** diff --git a/tests/GenericSparqlTest.php b/tests/GenericSparqlTest.php index f5497d7ff..b391b160a 100644 --- a/tests/GenericSparqlTest.php +++ b/tests/GenericSparqlTest.php @@ -17,14 +17,15 @@ protected function setUp() : void $this->vocab = $this->model->getVocabulary('test'); $this->graph = $this->vocab->getGraph(); $this->params = $this->getMockBuilder('ConceptSearchParameters')->disableOriginalConstructor()->getMock(); - $this->sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $this->graph, $this->model); + $this->endpoint = getenv('SKOSMOS_SPARQL_ENDPOINT'); + $this->sparql = new GenericSparql($this->endpoint, $this->graph, $this->model); } /** * @covers GenericSparql::__construct */ public function testConstructor() { - $gs = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $this->graph, $this->model); + $gs = new GenericSparql($this->endpoint, $this->graph, $this->model); $this->assertInstanceOf('GenericSparql', $gs); } @@ -32,7 +33,7 @@ public function testConstructor() { * @covers GenericSparql::getGraph */ public function testGetGraph() { - $gs = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $this->graph, $this->model); + $gs = new GenericSparql($this->endpoint, $this->graph, $this->model); $this->assertEquals($this->graph, $gs->getGraph()); } @@ -200,7 +201,7 @@ public function testQueryConceptsAlphabeticalLimitAndOffset() { public function testQualifiedNotationAlphabeticalList() { $voc = $this->model->getVocabulary('test-qualified-notation'); $res = new EasyRdf\Resource("http://www.w3.org/2004/02/skos/core#notation"); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $voc->getGraph(), $this->model); + $sparql = new GenericSparql($this->endpoint, $voc->getGraph(), $this->model); $actual = $sparql->queryConceptsAlphabetical("a", "en", null, null, null, false, $res); @@ -271,7 +272,7 @@ public function testQualifiedNotationAlphabeticalList() { public function testQualifiedBroaderAlphabeticalList() { $voc = $this->model->getVocabulary('test-qualified-broader'); $res = new EasyRdf\Resource("http://www.w3.org/2004/02/skos/core#broader"); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $voc->getGraph(), $this->model); + $sparql = new GenericSparql($this->endpoint, $voc->getGraph(), $this->model); $actual = $sparql->queryConceptsAlphabetical("a", "en", null, null, null, false, $res); @@ -391,7 +392,7 @@ public function testQueryConceptsAlphabeticalFull() { */ public function testQueryConceptInfoWithMultipleVocabs() { - $this->sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', '?graph', $this->model); + $this->sparql = new GenericSparql($this->endpoint, '?graph', $this->model); $voc2 = $this->model->getVocabulary('test'); $voc3 = $this->model->getVocabulary('dates'); $voc4 = $this->model->getVocabulary('groups'); @@ -413,7 +414,7 @@ public function testQueryConceptInfoWithMultipleVocabs() */ public function testQueryConceptInfoWithAllVocabs() { - $this->sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', '?graph', $this->model); + $this->sparql = new GenericSparql($this->endpoint, '?graph', $this->model); $actual = $this->sparql->queryConceptInfo(array('http://www.skosmos.skos/test/ta121', 'http://www.skosmos.skos/groups/ta111'), null, null, 'en'); $this->assertInstanceOf('Concept', $actual[0]); $this->assertEquals('http://www.skosmos.skos/test/ta121', $actual[0]->getUri()); @@ -490,7 +491,7 @@ public function testQueryConceptScheme() { $actual = $this->sparql->queryConceptScheme('http://www.skosmos.skos/test/conceptscheme'); $this->assertInstanceOf('EasyRdf\Graph', $actual); - $this->assertEquals('http://localhost:13030/skosmos-test/sparql', $actual->getUri()); + $this->assertEquals($this->endpoint, $actual->getUri()); } /** @@ -514,7 +515,7 @@ public function testQueryConceptSchemes() */ public function testQueryConceptSchemesSubject() { - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', 'http://www.skosmos.skos/test-concept-schemes/', $this->model); + $sparql = new GenericSparql($this->endpoint, 'http://www.skosmos.skos/test-concept-schemes/', $this->model); $actual = $sparql->queryConceptSchemes('en'); $expected = array( @@ -566,7 +567,7 @@ public function testQueryConceptsMultipleVocabs() $voc2 = $this->model->getVocabulary('groups'); $this->params->method('getSearchTerm')->will($this->returnValue('Carp')); $this->params->method('getVocabs')->will($this->returnValue(array($voc, $voc2))); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', '?graph', $this->model); + $sparql = new GenericSparql($this->endpoint, '?graph', $this->model); $actual = $sparql->queryConcepts(array($voc, $voc2), null, null, $this->params); $this->assertEquals(2, sizeof($actual)); $this->assertEquals('http://www.skosmos.skos/groups/ta112', $actual[0]['uri']); @@ -589,7 +590,7 @@ public function testQueryConceptsMultipleSchemes() // returns 3 concepts without the scheme limit, and only 2 with the scheme limit below $this->params->method('getSearchTerm')->will($this->returnValue('concept*')); $this->params->method('getSchemeLimit')->will($this->returnValue(array('http://www.skosmos.skos/multiple-schemes/cs1', 'http://www.skosmos.skos/multiple-schemes/cs2'))); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', 'http://www.skosmos.skos/multiple-schemes/', $this->model); + $sparql = new GenericSparql($this->endpoint, 'http://www.skosmos.skos/multiple-schemes/', $this->model); $actual = $sparql->queryConcepts(array($voc), null, null, $this->params); $this->assertEquals(2, sizeof($actual)); $this->assertEquals('http://www.skosmos.skos/multiple-schemes/c1-in-cs1', $actual[0]['uri']); @@ -1050,7 +1051,7 @@ public function testListConceptGroups() { $voc = $this->model->getVocabulary('groups'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $actual = $sparql->ListConceptGroups('http://www.w3.org/2004/02/skos/core#Collection', 'en'); $expected = array (0 => array ('prefLabel' => 'Fish', 'uri' => 'http://www.skosmos.skos/groups/fish', 'hasMembers' => true, 'childGroups' => array('http://www.skosmos.skos/groups/sub')), 1 => array ('prefLabel' => 'Freshwater fish', 'uri' => 'http://www.skosmos.skos/groups/fresh', 'hasMembers' => true), 2 => array ('prefLabel' => 'Saltwater fish', 'uri' => 'http://www.skosmos.skos/groups/salt', 'hasMembers' => true),3 => array ('prefLabel' => 'Submarine-like fish', 'uri' => 'http://www.skosmos.skos/groups/sub', 'hasMembers' => true)); $this->assertEquals($expected, $actual); @@ -1065,7 +1066,7 @@ public function testListConceptGroupContentsExcludingDeprecatedConcept() { $voc = $this->model->getVocabulary('groups'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $actual = $sparql->ListConceptGroupContents('http://www.w3.org/2004/02/skos/core#Collection', 'http://www.skosmos.skos/groups/salt', 'en'); $this->assertEquals('http://www.skosmos.skos/groups/ta113', $actual[0]['uri']); $this->assertEquals(1, sizeof($actual)); @@ -1080,7 +1081,7 @@ public function testListConceptGroupContentsIncludingDeprecatedConcept() { $voc = $this->model->getVocabulary('showDeprecated'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $actual = $sparql->ListConceptGroupContents('http://www.w3.org/2004/02/skos/core#Collection', 'http://www.skosmos.skos/groups/salt', 'en', $voc->getConfig()->getShowDeprecated()); $expected = array ( 0 => array ( @@ -1111,7 +1112,7 @@ public function testQueryChangeList() { $voc = $this->model->getVocabulary('changes'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $actual = $sparql->queryChangeList('dc:created', 'en', 0, 10); $order = array(); foreach($actual as $concept) { @@ -1129,7 +1130,7 @@ public function testQueryChangeList() public function testMalformedDates() { $voc = $this->model->getVocabulary('test'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $result = $sparql->queryChangeList('dc:modified', 'en', 0, 10); $uris = array(); foreach($result as $concept) { @@ -1146,7 +1147,7 @@ public function testLimitSearchToType() { $voc = $this->model->getVocabulary('test'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $this->params->method('getSearchTerm')->will($this->returnValue('*')); $this->params->method('getTypeLimit')->will($this->returnValue(array('mads:Topic'))); $actual = $this->sparql->queryConcepts(array($voc), null, true, $this->params); @@ -1186,7 +1187,7 @@ public function testQueryConceptsWithExtraFields() */ public function testQuerySuperProperties() { - $this->sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', '?graph', $this->model); + $this->sparql = new GenericSparql($this->endpoint, '?graph', $this->model); $actual = $this->sparql->querySuperProperties('http://example.com/myns#property'); $this->assertEquals(1, sizeof($actual)); $expected = array('http://example.com/myns#superProperty'); @@ -1202,7 +1203,7 @@ public function testQueryAllConceptLabels() { $voc = $this->model->getVocabulary('test'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $actual = $sparql->queryAllConceptLabels('http://www.skosmos.skos/test/ta112', 'en'); @@ -1224,7 +1225,7 @@ public function testQueryAllConceptLabelsNonexistentConcept() { $voc = $this->model->getVocabulary('test'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $actual = $sparql->queryAllConceptLabels('http://www.skosmos.skos/test/notfound', 'en'); @@ -1240,7 +1241,7 @@ public function testQueryAllConceptLabelsNoPrefLabel() { $voc = $this->model->getVocabulary('test'); $graph = $voc->getGraph(); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new GenericSparql($this->endpoint, $graph, $this->model); $actual = $sparql->queryAllConceptLabels('http://www.skosmos.skos/test/ta112', 'sv'); diff --git a/tests/GlobalConfigTest.php b/tests/GlobalConfigTest.php index d23d2d05a..7715a3952 100644 --- a/tests/GlobalConfigTest.php +++ b/tests/GlobalConfigTest.php @@ -23,7 +23,7 @@ protected function setUp() : void public function testGetDefaultEndpoint() { - $this->assertEquals("http://localhost:13030/skosmos-test/sparql", $this->config->getDefaultEndpoint()); + $this->assertEquals(getenv('SKOSMOS_SPARQL_ENDPOINT'), $this->config->getDefaultEndpoint()); } public function testGetDefaultSparqlDialect() diff --git a/tests/JenaTextSparqlTest.php b/tests/JenaTextSparqlTest.php index 525062e06..821303f38 100644 --- a/tests/JenaTextSparqlTest.php +++ b/tests/JenaTextSparqlTest.php @@ -17,14 +17,15 @@ protected function setUp() : void $this->vocab = $this->model->getVocabulary('test'); $this->graph = $this->vocab->getGraph(); $this->params = $this->getMockBuilder('ConceptSearchParameters')->disableOriginalConstructor()->getMock(); - $this->sparql = new JenaTextSparql('http://localhost:13030/skosmos-test/sparql', $this->graph, $this->model); + $this->endpoint = getenv('SKOSMOS_SPARQL_ENDPOINT'); + $this->sparql = new JenaTextSparql($this->endpoint, $this->graph, $this->model); } /** * @covers JenaTextSparql::__construct */ public function testConstructor() { - $gs = new JenaTextSparql('http://localhost:13030/skosmos-test/sparql', $this->graph, $this->model); + $gs = new JenaTextSparql($this->endpoint, $this->graph, $this->model); $this->assertInstanceOf('JenaTextSparql', $gs); } @@ -117,7 +118,7 @@ public function testQueryConceptsAlphabeticalLimitAndOffset() { public function testQualifiedNotationAlphabeticalList() { $voc = $this->model->getVocabulary('test-qualified-notation'); $res = new EasyRdf\Resource("http://www.w3.org/2004/02/skos/core#notation"); - $sparql = new GenericSparql('http://localhost:13030/skosmos-test/sparql', $voc->getGraph(), $this->model); + $sparql = new GenericSparql($this->endpoint, $voc->getGraph(), $this->model); $actual = $sparql->queryConceptsAlphabetical("a", "en", null, null, null, false, $res); @@ -187,7 +188,7 @@ public function testQualifiedNotationAlphabeticalList() { public function testQualifiedBroaderAlphabeticalList() { $voc = $this->model->getVocabulary('test-qualified-broader'); $res = new EasyRdf\Resource("http://www.w3.org/2004/02/skos/core#broader"); - $sparql = new JenaTextSparql('http://localhost:13030/skosmos-test/sparql', $voc->getGraph(), $this->model); + $sparql = new JenaTextSparql($this->endpoint, $voc->getGraph(), $this->model); $actual = $sparql->queryConceptsAlphabetical("a", "en", null, null, null, false, $res); @@ -358,7 +359,7 @@ public function testQueryConceptsDefaultGraph() public function testQueryConceptsAlphabeticalOrderBy() { $vocab = $this->model->getVocabulary('collation'); $graph = $vocab->getGraph(); - $sparql = new JenaTextSparql('http://localhost:13030/skosmos-test/sparql', $graph, $this->model); + $sparql = new JenaTextSparql($this->endpoint, $graph, $this->model); $actual = $sparql->queryConceptsAlphabetical('t', 'fi'); $expected = array ( 0 => array ( diff --git a/tests/jenatestconfig.ttl b/tests/jenatestconfig.ttl index 066dfb739..b797da96e 100644 --- a/tests/jenatestconfig.ttl +++ b/tests/jenatestconfig.ttl @@ -19,9 +19,8 @@ # Skosmos main configuration :config a skosmos:Configuration ; - # SPARQL endpoint - # a local Fuseki server is usually on localhost:3030 - skosmos:sparqlEndpoint "http://localhost:13030/skosmos-test/sparql" ; + # SPARQL endpoint defaults to $SKOSMOS_SPARQL_ENDPOINT environment var + # skosmos:sparqlEndpoint ; # sparql-query extension, or "Generic" for plain SPARQL 1.1 # set to "JenaText" instead if you use Fuseki with jena-text index skosmos:sparqlDialect "JenaText" ; @@ -70,7 +69,6 @@ dc:subject :cat_science ; dc:type mdrtype:ONTOLOGY ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test/"; skos:prefLabel "Test ontology"@en ; skosmos:arrayClass isothes:ThesaurusArray ; @@ -88,7 +86,6 @@ dc:title "Test qualified alphabetical listing queries (skos:broader)"@en ; dc:subject :cat_science ; dc:type mdrtype:ONTOLOGY ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test-qualified-broader/" ; skosmos:defaultLanguage "en" ; skosmos:groupClass skos:Collection ; @@ -100,7 +97,6 @@ dc:title "Test qualified alphabetical listing queries (skos:notation)"@en ; dc:subject :cat_science ; dc:type mdrtype:ONTOLOGY ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test-qualified-notation/" ; skosmos:defaultLanguage "en" ; skosmos:groupClass skos:Collection ; @@ -112,7 +108,6 @@ skos:prefLabel "Mutiple Schemes vocabulary"@en ; dc:title "Mutiple Schemes vocabulary"@en ; dc:type mdrtype:ONTOLOGY ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/multiple-schemes/"; skosmos:defaultLanguage "en"; skosmos:language "en"; @@ -123,7 +118,6 @@ dc11:title "Test ontology 2"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/testdiff#"; - void:sparqlEndpoint ; skosmos:language "fi", "en"; skosmos:sparqlDialect "JenaText"; skosmos:fullAlphabeticalIndex "true"; @@ -142,7 +136,6 @@ void:uriSpace "http://www.skosmos.skos/onto/groups/"; skosmos:arrayClass isothes:ThesaurusArray ; skosmos:groupClass skos:Collection ; - void:sparqlEndpoint ; skosmos:language "fi", "en"; skosmos:defaultLanguage "fi"; skosmos:indexShowClass meta:TestClass, meta:TestClass2; @@ -157,7 +150,6 @@ void:uriSpace "http://www.exemple.fr/"; skosmos:arrayClass isothes:ThesaurusArray ; skosmos:groupClass skos:Collection ; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:defaultLanguage "en"; skosmos:sparqlGraph . @@ -170,7 +162,6 @@ void:uriSpace "http://www.skosmos.skos/onto/groups/"; skosmos:arrayClass isothes:ThesaurusArray ; skosmos:groupClass skos:Collection ; - void:sparqlEndpoint ; skosmos:language "fi", "en"; skosmos:defaultLanguage "fi"; skosmos:showDeprecated "true"; @@ -180,7 +171,6 @@ dc11:title "Cycle test vocabulary"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/cycle/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -188,7 +178,6 @@ dc11:title "Duplicate labels test vocabulary"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/dup/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -199,7 +188,6 @@ rdfs:label "Date information vocabulary"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/date/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:showPropertyInSearch skos:exactMatch; skosmos:hasMultiLingualProperty skos:altLabel ; @@ -210,7 +198,6 @@ dc11:title "Vocabulary with mappings"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/mapping/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -218,7 +205,6 @@ dc11:title "A vocabulary for testing the change list creation"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/changes/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -226,7 +212,6 @@ dc11:title "A vocabulary for testing custom prefixes"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/prefix/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -234,7 +219,6 @@ dc11:title "Subproperties of hiddenLabel"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/sub/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -242,7 +226,6 @@ dc11:title "SuperGroup and member relationship double trouble"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/dupgroup/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -250,7 +233,6 @@ dc11:title "A vocabulary for testing language subtags"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/subtag/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:fallbackLanguages ( "fr" "de" "sv" ) ; skosmos:sparqlGraph ; @@ -260,7 +242,6 @@ dc11:title "A vocabulary for test SPARQL with collation"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/collation/"; - void:sparqlEndpoint ; skosmos:language "fi"; skosmos:sparqlGraph . @@ -272,7 +253,6 @@ skosmos:externalProperty dc11:creator ; skosmos:externalProperty dc11:relation ; skosmos:externalProperty rdfs:comment ; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -280,7 +260,6 @@ dc11:title "A vocabulary for testing SKOS XL"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/xl/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . diff --git a/tests/testconfig.ttl b/tests/testconfig.ttl index a48e969e5..390079d74 100644 --- a/tests/testconfig.ttl +++ b/tests/testconfig.ttl @@ -21,9 +21,8 @@ # Skosmos main configuration :config a skosmos:Configuration ; - # SPARQL endpoint - # a local Fuseki server is usually on localhost:3030 - skosmos:sparqlEndpoint ; + # SPARQL endpoint defaults to $SKOSMOS_SPARQL_ENDPOINT environment var + # skosmos:sparqlEndpoint ; # sparql-query extension, or "Generic" for plain SPARQL 1.1 # set to "JenaText" instead if you use Fuseki with jena-text index # skosmos:sparqlDialect "JenaText" ; @@ -74,7 +73,6 @@ dc:subject :cat_science ; dc:type mdrtype:ONTOLOGY ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test/"; skos:prefLabel "Test ontology"@en ; skosmos:arrayClass isothes:ThesaurusArray ; @@ -93,7 +91,6 @@ dc:title "Test notation sort ontology"@en ; dc:subject :cat_science ; dc:type mdrtype:ONTOLOGY ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test-notation-sort/"; skos:prefLabel "Test notation sort ontology"@en ; skosmos:defaultLanguage "en"; @@ -106,7 +103,6 @@ dc:title "Test qualified alphabetical listing queries (skos:broader)"@en ; dc:subject :cat_science ; dc:type mdrtype:ONTOLOGY ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test-qualified-broader/" ; skosmos:defaultLanguage "en" ; skosmos:groupClass skos:Collection ; @@ -118,7 +114,6 @@ dc:title "Test qualified alphabetical listing queries (skos:notation)"@en ; dc:subject :cat_science ; dc:type mdrtype:ONTOLOGY ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test-qualified-notation/" ; skosmos:defaultLanguage "en" ; skosmos:groupClass skos:Collection ; @@ -132,7 +127,6 @@ dc:type mdrtype:ONTOLOGY ; void:dataDump ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test-marc/"; skosmos:defaultLanguage "fi" ; skosmos:marcSourceCode "test/fin"@fi, "test/swe"@sv ; @@ -145,7 +139,6 @@ dc:title "Test undefined marc source"@en ; dc:type mdrtype:ONTOLOGY ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test-marc/" ; skosmos:defaultLanguage "fi" ; skosmos:marcSourceCode "test/fin"@fi, "test/swe"@sv ; @@ -165,7 +158,6 @@ skos:prefLabel "Mutiple Schemes vocabulary"@en ; dc:title "Mutiple Schemes vocabulary"@en ; dc:type mdrtype:ONTOLOGY ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/multiple-schemes/"; skosmos:defaultLanguage "en"; skosmos:marcSourceCode "ysa/gen"; @@ -177,7 +169,6 @@ dc11:title "Test ontology 2"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/testdiff#"; - void:sparqlEndpoint ; skosmos:language "fi", "en"; skosmos:sparqlDialect "JenaText"; skosmos:fullAlphabeticalIndex "true"; @@ -196,7 +187,6 @@ void:uriSpace "http://www.skosmos.skos/onto/groups/"; skosmos:arrayClass isothes:ThesaurusArray ; skosmos:groupClass skos:Collection ; - void:sparqlEndpoint ; skosmos:language "fi", "en"; skosmos:defaultLanguage "fi"; skosmos:indexShowClass meta:TestClass, meta:TestClass2; @@ -211,7 +201,6 @@ void:uriSpace "http://www.exemple.fr/"; skosmos:arrayClass isothes:ThesaurusArray ; skosmos:groupClass skos:Collection ; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:defaultLanguage "en"; skosmos:sparqlGraph . @@ -224,7 +213,6 @@ void:uriSpace "http://www.skosmos.skos/onto/groups/"; skosmos:arrayClass isothes:ThesaurusArray ; skosmos:groupClass skos:Collection ; - void:sparqlEndpoint ; skosmos:language "fi", "en"; skosmos:defaultLanguage "fi"; skosmos:showDeprecated "true"; @@ -234,7 +222,6 @@ dc11:title "Cycle test vocabulary"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/cycle/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -242,7 +229,6 @@ dc11:title "Duplicate labels test vocabulary"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/dup/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -253,7 +239,6 @@ rdfs:label "Date information vocabulary"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/date/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:showPropertyInSearch skos:exactMatch; skosmos:hasMultiLingualProperty skos:altLabel ; @@ -264,7 +249,6 @@ dc11:title "Vocabulary with mappings"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/mapping/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -272,7 +256,6 @@ dc11:title "A vocabulary for testing the change list creation"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/changes/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -280,7 +263,6 @@ dc11:title "A vocabulary for testing custom prefixes"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/prefix/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -288,7 +270,6 @@ dc11:title "Subproperties of hiddenLabel"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/sub/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -296,7 +277,6 @@ dc11:title "SuperGroup and member relationship double trouble"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/onto/dupgroup/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -304,7 +284,6 @@ dc11:title "A vocabulary for testing language subtags"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/subtag/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:fallbackLanguages ( "fr" "de" "sv" ) ; skosmos:sparqlGraph ; @@ -314,7 +293,6 @@ dc11:title "A vocabulary for test SPARQL with collation"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/collation/"; - void:sparqlEndpoint ; skosmos:language "fi"; skosmos:sparqlGraph . @@ -326,7 +304,6 @@ skosmos:externalProperty dc11:creator ; skosmos:externalProperty dc11:relation ; skosmos:externalProperty rdfs:comment ; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -334,7 +311,6 @@ dc11:title "A vocabulary for testing SKOS XL"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/xl/"; - void:sparqlEndpoint ; skosmos:language "en"; skosmos:sparqlGraph . @@ -342,7 +318,6 @@ dc11:title "A vocabulary for testing HTTP 304 new settings"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/http304disabled/"; - void:sparqlEndpoint ; skosmos:language "fi"; skosmos:useModifiedDate "false"; skosmos:sparqlGraph ; @@ -352,7 +327,6 @@ dc11:title "A vocabulary for testing HTTP 304 new settings"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/http304enabled/"; - void:sparqlEndpoint ; skosmos:language "fi"; skosmos:useModifiedDate "true"; skosmos:sparqlGraph ; @@ -362,7 +336,6 @@ dc11:title "A vocabulary for testing vocabularies with notation features"@en ; dc:subject :cat_general ; void:uriSpace "http://www.skosmos.skos/notationFeatures/"; - void:sparqlEndpoint ; skosmos:language "fi"; skosmos:sortByNotation true ; skosmos:searchByNotation true ; @@ -376,7 +349,6 @@ dc:subject :cat_science ; dc:type mdrtype:ONTOLOGY ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/test/"; skos:prefLabel "Test plugin parameters"@en ; skosmos:arrayClass isothes:ThesaurusArray ; @@ -408,7 +380,6 @@ dc:subject :cat_science ; skosmos:propertyOrder skosmos:iso25964PropertyOrder ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/testOrder/"; skosmos:language "en"; skosmos:sparqlGraph . @@ -418,7 +389,6 @@ dc:subject :cat_science ; skosmos:propertyOrder skosmos:defaultPropertyOrder ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/testOrder/"; skosmos:language "en"; skosmos:sparqlGraph . @@ -432,7 +402,6 @@ skos:historyNote skos:prefLabel ) ] ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/testOrder/"; skosmos:language "en"; skosmos:sparqlGraph . @@ -442,7 +411,6 @@ dc:subject :cat_science ; skosmos:propertyOrder skosmos:unknown ; void:dataDump ; - void:sparqlEndpoint ; void:uriSpace "http://www.skosmos.skos/testOrder/"; skosmos:language "en"; skosmos:sparqlGraph . From 71b21f6df852a90fc22f6156b1a9ba43db8c5771 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 10:53:09 +0300 Subject: [PATCH 17/42] ensure the SKOSMOS_SPARQL_ENDPOINT envvar is always set when running tests --- tests/bootstrap.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 04cb7fd10..f8175a878 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,3 +1,11 @@ Date: Tue, 25 May 2021 14:04:47 +0300 Subject: [PATCH 18/42] Revert "drop strict composer validation as it won't pass anyway" This reverts commit a484aae0a1d8f2f070f0b8fdcb91cdac5eefbfc3. --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 262eccd19..b16077d00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,9 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Validate composer.json and composer.lock + run: composer validate --strict + - name: Cache Composer packages id: composer-cache uses: actions/cache@v2 From 19e0aec6d67fe88638bb5b709c8ceb63e7e220db Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 14:04:59 +0300 Subject: [PATCH 19/42] Revert "avoid using container based php-actions" This reverts commit d1fd2b6bdf0d0a13913924dc1742120fc069ec6f. --- .github/workflows/ci.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b16077d00..9b03a4cfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,21 +14,16 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 + + - name: Install Composer dependencies + uses: php-actions/composer@v5 with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - run: composer install --prefer-dist --no-progress + php_version: 7.4 + php_extensions: gettext intl xsl - name: Run PHPUnit tests - run: composer run-script test + uses: php-actions/phpunit@v2 + with: + version: 8.5 + php_version: 7.4 + php_extensions: gettext intl xsl From 9d5cb14b86be3b8f72a6d1a7ab8284a9f3ed5e05 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 14:09:30 +0300 Subject: [PATCH 20/42] specify Fuseki endpoint URL via environment variable --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b03a4cfd..6f5530542 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,9 @@ jobs: services: fuseki: image: stain/jena-fuseki - ports: - - 13030:3030 + + env: + SKOSMOS_SPARQL_ENDPOINT: http://fuseki:3030/skosmos-test/sparql steps: - uses: actions/checkout@v2 From 97e1bc836f318e536c511861abeba916457f52b6 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 15:35:34 +0300 Subject: [PATCH 21/42] Use osma/phpunit action (forked from php-actions/phpunit) with host networking --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f5530542..2d261f889 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,9 +9,7 @@ jobs: services: fuseki: image: stain/jena-fuseki - - env: - SKOSMOS_SPARQL_ENDPOINT: http://fuseki:3030/skosmos-test/sparql + ports: 13030:3030 steps: - uses: actions/checkout@v2 @@ -23,7 +21,7 @@ jobs: php_extensions: gettext intl xsl - name: Run PHPUnit tests - uses: php-actions/phpunit@v2 + uses: osma/phpunit@v1 with: version: 8.5 php_version: 7.4 From c60703ec10d4b7c9b66941b58cdff0f7fb8be2a5 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 15:39:49 +0300 Subject: [PATCH 22/42] fix ci.yml syntax for ports (doh) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d261f889..61dd59c8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: services: fuseki: image: stain/jena-fuseki - ports: 13030:3030 + ports: 13030:3030 steps: - uses: actions/checkout@v2 From e5bb8f760162f888649a4ae3a55e52fb193d8ba4 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 15:42:57 +0300 Subject: [PATCH 23/42] fix syntax again --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61dd59c8c..332f71ca7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,8 @@ jobs: services: fuseki: image: stain/jena-fuseki - ports: 13030:3030 + ports: + - 13030:3030 steps: - uses: actions/checkout@v2 From cc5806ff481385368c67bba2b87b461ac65a2cab Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 16:14:57 +0300 Subject: [PATCH 24/42] use the correct version of osma/phpunit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 332f71ca7..cc6134d5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: php_extensions: gettext intl xsl - name: Run PHPUnit tests - uses: osma/phpunit@v1 + uses: osma/phpunit@v2-host-network with: version: 8.5 php_version: 7.4 From d778877231a6f0eeb2b8c99c847c1d5d77a99de3 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 16:38:47 +0300 Subject: [PATCH 25/42] use v2-network-host --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc6134d5c..7e9a21477 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: php_extensions: gettext intl xsl - name: Run PHPUnit tests - uses: osma/phpunit@v2-host-network + uses: osma/phpunit@v2-network-host with: version: 8.5 php_version: 7.4 From 2974297138f8eb385aa79853dd9fd95d73a71074 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 16:47:14 +0300 Subject: [PATCH 26/42] Use osma/phpunit@v2-network-host-debug for more debugging info --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e9a21477..b4c758972 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: php_extensions: gettext intl xsl - name: Run PHPUnit tests - uses: osma/phpunit@v2-network-host + uses: osma/phpunit@v2-network-host-debug with: version: 8.5 php_version: 7.4 From 57b198768fe6c86b976ae8a324ff4d6110e48a2c Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 25 May 2021 17:06:24 +0300 Subject: [PATCH 27/42] use the init_fuseki.sh script instead of a service container --- .github/workflows/ci.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4c758972..cd6bcbd92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,14 +6,12 @@ jobs: build-test: runs-on: ubuntu-latest - services: - fuseki: - image: stain/jena-fuseki - ports: - - 13030:3030 - steps: - - uses: actions/checkout@v2 + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Start up Fuseki + run: cd tests; sh ./init_fuseki.sh - name: Install Composer dependencies uses: php-actions/composer@v5 From 6b81cb8718e23e50d78a653fbd2f1a209cca913e Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 09:42:12 +0300 Subject: [PATCH 28/42] run tests in parallel on PHP versions 7.2, 7.3 and 7.4 --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd6bcbd92..b0a760c3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,9 @@ on: [push] jobs: build-test: runs-on: ubuntu-latest + strategy: + matrix: + php_version: [7.2, 7.3, 7.4] steps: - name: Check out repository code @@ -16,12 +19,12 @@ jobs: - name: Install Composer dependencies uses: php-actions/composer@v5 with: - php_version: 7.4 + php_version: ${{ matrix.php_version }} php_extensions: gettext intl xsl - name: Run PHPUnit tests uses: osma/phpunit@v2-network-host-debug with: version: 8.5 - php_version: 7.4 + php_version: ${{ matrix.php_version }} php_extensions: gettext intl xsl From 717808932dad30613540469ef62230929c2eef0d Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 09:48:50 +0300 Subject: [PATCH 29/42] Cache Composer dependencies to speed up builds --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0a760c3f..a5cf21b7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,12 @@ jobs: - name: Start up Fuseki run: cd tests; sh ./init_fuseki.sh + - name: Cache Composer dependencies + uses: actions/cache@v2 + with: + path: /tmp/composer-cache + key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + - name: Install Composer dependencies uses: php-actions/composer@v5 with: From be59bdb7e55877695c5b0c1081dd93ed0e435b70 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 11:04:43 +0300 Subject: [PATCH 30/42] Different way of caching Composer dependencies (we don't have composer.lock in the repo) --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5cf21b7a..5452978be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,12 @@ jobs: - name: Cache Composer dependencies uses: actions/cache@v2 with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + path: | + /tmp/composer-cache + vendor + key: ${{ runner.os }}-php${{ matrix.php_version}-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-php${{ matrix.php_version}- - name: Install Composer dependencies uses: php-actions/composer@v5 From 3f9ce1b82c8f3e48dffe738c73e7141e38cbf2f6 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 11:09:34 +0300 Subject: [PATCH 31/42] fix syntax --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5452978be..8de4d0ff6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,9 +22,9 @@ jobs: path: | /tmp/composer-cache vendor - key: ${{ runner.os }}-php${{ matrix.php_version}-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-php${{ matrix.php_version}}-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php${{ matrix.php_version}- + ${{ runner.os }}-php${{ matrix.php_version}}- - name: Install Composer dependencies uses: php-actions/composer@v5 From 37170ecd43bb20913754c875466bfb28cfd6f03a Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 11:21:31 +0300 Subject: [PATCH 32/42] Attempt to cache Fuseki installation --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8de4d0ff6..8babca743 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,12 @@ jobs: - name: Check out repository code uses: actions/checkout@v2 + - name: Cache Fuseki installation + uses: actions/cache@v2 + with: + path: tests/apache-jena-fuseki-* + key: fuseki-${{ hashFiles('tests/init_fuseki.sh') }} + - name: Start up Fuseki run: cd tests; sh ./init_fuseki.sh From 94ed814ffa84ed387f690ba1e0e39efb2ab1d969 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 11:41:41 +0300 Subject: [PATCH 33/42] Enable PCOV extension for code coverage information --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8babca743..2623d0142 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,11 +36,11 @@ jobs: uses: php-actions/composer@v5 with: php_version: ${{ matrix.php_version }} - php_extensions: gettext intl xsl + php_extensions: gettext intl xsl pcov - name: Run PHPUnit tests uses: osma/phpunit@v2-network-host-debug with: version: 8.5 php_version: ${{ matrix.php_version }} - php_extensions: gettext intl xsl + php_extensions: gettext intl xsl pcov From b2fdf684a2a54ecfffc923d1265e3ab67d5bf631 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 12:23:18 +0300 Subject: [PATCH 34/42] disable fail-fast to avoid one failed job canceling the others --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2623d0142..e3d80aff0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ jobs: strategy: matrix: php_version: [7.2, 7.3, 7.4] + fail-fast: false steps: - name: Check out repository code From fe3a40ff64c64ca007475d025f3f57369f12dd8d Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 12:33:59 +0300 Subject: [PATCH 35/42] Increase memory_limit to 512M for PHPUnit tests (128M isn't enough with pcov) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3d80aff0..5b6c02a2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,3 +45,4 @@ jobs: version: 8.5 php_version: ${{ matrix.php_version }} php_extensions: gettext intl xsl pcov + memory_limit: 512M From b2a3f53ad3985574a29b3dc6fa44f81d7b1282d1 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 12:54:38 +0300 Subject: [PATCH 36/42] publish coverage report to Code Climate --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b6c02a2e..f54dfbf66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,3 +46,8 @@ jobs: php_version: ${{ matrix.php_version }} php_extensions: gettext intl xsl pcov memory_limit: 512M + + - name: Publish code coverage to Code Climate + uses: paambaati/codeclimate-action@v2.7.5 + env: + CC_TEST_REPORTER_ID: fb98170a5c7ea9cc2bbab19ff26268335e6a11a4f8267ca935e5e8ff4624886c From fe791af80dbb226ce01f5ea0bf378f4c1d84f0a5 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 13:18:07 +0300 Subject: [PATCH 37/42] set a prefix for the Code Climate reporter step to fix(?) path issues --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f54dfbf66..51e1032f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,3 +51,5 @@ jobs: uses: paambaati/codeclimate-action@v2.7.5 env: CC_TEST_REPORTER_ID: fb98170a5c7ea9cc2bbab19ff26268335e6a11a4f8267ca935e5e8ff4624886c + with: + prefix: ${{ github.workspace }} From 9138e3ca9d8d967bb895d8456f6a759d7b693060 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 13:25:13 +0300 Subject: [PATCH 38/42] enable debugging on codeclimate reporter and try to fix path issue w/ symlink --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51e1032f7..d932e108a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,4 +52,5 @@ jobs: env: CC_TEST_REPORTER_ID: fb98170a5c7ea9cc2bbab19ff26268335e6a11a4f8267ca935e5e8ff4624886c with: - prefix: ${{ github.workspace }} + coverageCommand: ln -s . app + debug: true From 92dc7f6dbbe3f7d2b172382e6a772102b65dfa4f Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 13:32:51 +0300 Subject: [PATCH 39/42] Test if prefix /app would help solve Code Climate path issue --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d932e108a..556620bd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,5 +52,5 @@ jobs: env: CC_TEST_REPORTER_ID: fb98170a5c7ea9cc2bbab19ff26268335e6a11a4f8267ca935e5e8ff4624886c with: - coverageCommand: ln -s . app + prefix: /app debug: true From 100a20ea52d792cf18b7d04338ea21abf152c83d Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 13:40:18 +0300 Subject: [PATCH 40/42] Disable Code Climate debug since it's now working --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 556620bd7..ab66b5bba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,4 +53,3 @@ jobs: CC_TEST_REPORTER_ID: fb98170a5c7ea9cc2bbab19ff26268335e6a11a4f8267ca935e5e8ff4624886c with: prefix: /app - debug: true From b6141558185437edf4504e76d75952a4c5fdf538 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 13:46:52 +0300 Subject: [PATCH 41/42] Publish code coverage to Codecov --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab66b5bba..38a45b7f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,3 +53,8 @@ jobs: CC_TEST_REPORTER_ID: fb98170a5c7ea9cc2bbab19ff26268335e6a11a4f8267ca935e5e8ff4624886c with: prefix: /app + + - name: Publish code coverage to Codecov + uses: codecov/codecov-action@v1 + with: + verbose: true From 33408f7ff02f39595809fc7febbf9d1e8ca38445 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Wed, 26 May 2021 13:53:20 +0300 Subject: [PATCH 42/42] Disable verbose setting for Codecov as it's now working --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38a45b7f9..41432ea2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,5 +56,3 @@ jobs: - name: Publish code coverage to Codecov uses: codecov/codecov-action@v1 - with: - verbose: true