This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from idimopoulos/ISAICP-5599
- Loading branch information
Showing
14 changed files
with
289 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
language: php | ||
|
||
php: | ||
- '7.2' | ||
- '7.3' | ||
- '7.4' | ||
|
||
sudo: required | ||
|
||
services: | ||
- mysql | ||
- docker | ||
|
||
mysql: | ||
database: sparql_entity_storage_test | ||
username: root | ||
encoding: utf8 | ||
|
||
env: | ||
global: | ||
- SITE_DIR="$HOME/build/testing_site" | ||
matrix: | ||
- TEST=PHPCodeSniffer | ||
- TEST=PHPStan DRUPAL=~8.9.0 PHPUNIT=^7 | ||
- TEST=PHPUnit DRUPAL=~8.9.0 PHPUNIT=^7 | ||
- TEST=PHPUnit DRUPAL=~9.0.0 PHPUNIT=^8 | ||
- TEST=PHPUnit DRUPAL=~9.1.0 PHPUNIT=^8 | ||
- TEST=PHPUnit DRUPAL=~9.2.0 PHPUNIT=^8 | ||
|
||
matrix: | ||
fast_finish: true | ||
exclude: | ||
- php: '7.2' | ||
env: TEST=PHPUnit DRUPAL=~9.0.0 PHPUNIT=^8 | ||
- php: '7.2' | ||
env: TEST=PHPUnit DRUPAL=~9.1.0 PHPUNIT=^8 | ||
- php: '7.2' | ||
env: TEST=PHPUnit DRUPAL=~9.2.0 PHPUNIT=^8 | ||
- php: '7.3' | ||
env: TEST=PHPCodeSniffer | ||
- php: '7.3' | ||
env: TEST=PHPStan DRUPAL=~8.9.0 PHPUNIT=^7 | ||
- php: '7.4' | ||
env: TEST=PHPCodeSniffer | ||
- php: '7.4' | ||
env: TEST=PHPStan DRUPAL=~8.9.0 PHPUNIT=^7 | ||
|
||
before_install: | ||
# Remove this line to run with Xdebug enabled. | ||
- phpenv config-rm xdebug.ini || true | ||
|
||
script: ${TRAVIS_BUILD_DIR}/tests/travis-ci/scripts/run_tests.sh | ||
|
||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0"?> | ||
<!-- PHP_CodeSniffer standard for Drupal modules. --> | ||
<!-- See http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php --> | ||
<ruleset name="Drupal Module"> | ||
<description>Drupal coding standard for contributed modules</description> | ||
|
||
<!-- Exclude unsupported file types. --> | ||
<exclude-pattern>*.gif</exclude-pattern> | ||
<exclude-pattern>*.less</exclude-pattern> | ||
<exclude-pattern>*.png</exclude-pattern> | ||
|
||
<!-- Minified files don't have to comply with coding standards. --> | ||
<exclude-pattern>*.min.css</exclude-pattern> | ||
<exclude-pattern>*.min.js</exclude-pattern> | ||
|
||
<rule ref="./vendor/drupal/coder/coder_sniffer/Drupal"> | ||
<!-- URLs in deprecation messages point to Github rather than drupal.org. --> | ||
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorSeeUrlFormat" /> | ||
<!-- Deprecation versions are allowed to include beta versions. --> | ||
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorVersion" /> | ||
</rule> | ||
<rule ref="./vendor/drupal/coder/coder_sniffer/DrupalPractice"> | ||
<exclude name="DrupalPractice.Objects.GlobalFunction.GlobalFunction" /> | ||
<exclude name="DrupalPractice.Objects.GlobalDrupal.GlobalDrupal" /> | ||
<exclude name="DrupalPractice.InfoFiles.NamespacedDependency.NonNamespaced" /> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="pbm_default"> | ||
<description>Default PHP CodeSniffer configuration for SPARQL Entity Storage.</description> | ||
<rule ref="phpcs-ruleset.xml.dist"/> | ||
<arg name="extensions" value="php,inc,module,install,info,test,profile,theme,css,js"/> | ||
<arg name="report" value="full"/> | ||
<arg value="p"/> | ||
<file>.</file> | ||
<exclude-pattern>./vendor</exclude-pattern> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"require": { | ||
"composer/installers": "^1.5.0", | ||
"cweagans/composer-patches": "^1.6.5", | ||
"drupal/core": "${DRUPAL}", | ||
"drupal/core-composer-scaffold": "*", | ||
"drupal/pathauto": "*", | ||
"drupal/sparql_entity_storage": "*", | ||
"drupal/token": "*", | ||
"drush/drush": "~10", | ||
"easyrdf/easyrdf": "1.0.0 as 0.9.2", | ||
"ml/json-ld": "^1.0" | ||
}, | ||
"require-dev": { | ||
"behat/mink-goutte-driver": "~1.2", | ||
"mikey179/vfsstream": "~1.2", | ||
"minimaxir/big-list-of-naughty-strings": "dev-master", | ||
"mglaman/phpstan-drupal": "^0.12.6", | ||
"phpspec/prophecy": "^1.7", | ||
"phpstan/phpstan-deprecation-rules": "^0.12.5", | ||
"phpunit/phpunit": "${PHPUNIT}", | ||
"symfony/phpunit-bridge": "^5.1.4" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"repositories": [ | ||
{ | ||
"type": "path", | ||
"url": "${TRAVIS_BUILD_DIR}" | ||
}, | ||
{ | ||
"type": "package", | ||
"package": { | ||
"name": "minimaxir/big-list-of-naughty-strings", | ||
"version": "dev-master", | ||
"dist": { | ||
"url": "https://github.com/minimaxir/big-list-of-naughty-strings/archive/master.zip", | ||
"type": "zip" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "composer", | ||
"url": "https://packages.drupal.org/8" | ||
} | ||
], | ||
"extra": { | ||
"installer-paths": { | ||
"web/core": ["type:drupal-core"], | ||
"web/modules/{$name}": ["type:drupal-module"] | ||
}, | ||
"drupal-scaffold": { | ||
"locations": { | ||
"web-root": "web/" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
$databases['sparql_default']['default'] = array ( | ||
'prefix' => '', | ||
'host' => '127.0.0.1', | ||
'port' => 8890, | ||
'namespace' => 'Drupal\\sparql_entity_storage\\Driver\\Database\\sparql', | ||
'driver' => 'sparql', | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
parameters: | ||
customRulesetUsed: true | ||
reportUnmatchedIgnoredErrors: false | ||
includes: | ||
- vendor/mglaman/phpstan-drupal/extension.neon | ||
- vendor/phpstan/phpstan-deprecation-rules/rules.neon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="web/core/tests/bootstrap.php" | ||
colors="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutChangesToGlobalState="true" | ||
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter" | ||
> | ||
<php> | ||
<ini name="error_reporting" value="32767"/> | ||
<ini name="memory_limit" value="-1"/> | ||
<env name="SIMPLETEST_BASE_URL" value="http://localhost:8888"/> | ||
<env name="SIMPLETEST_DB" value="mysql://root:@127.0.0.1/sparql_entity_storage_test_phpunit"/> | ||
<env name="SIMPLETEST_SPARQL_DB" value="sparql://127.0.0.1:8890?module=sparql_entity_storage"/> | ||
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value="/tmp"/> | ||
<env name="BROWSERTEST_OUTPUT_FILE" value="/tmp/browser_output/outputfile.txt"/> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="99999"/> | ||
</php> | ||
<testsuites> | ||
<testsuite name="sparql_entity_storage"> | ||
<directory>./web/modules/sparql_entity_storage</directory> | ||
</testsuite> | ||
</testsuites> | ||
<listeners> | ||
<listener class="\Drupal\Tests\Listeners\DrupalListener"/> | ||
</listeners> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
|
||
install_codebase () { | ||
mkdir -p ${SITE_DIR}/web/modules | ||
cp ${TRAVIS_BUILD_DIR}/tests/travis-ci/fixtures/composer.json.dist ${SITE_DIR}/composer.json | ||
cd ${SITE_DIR} | ||
perl -i -pe's/\$\{([^}]+)\}/$ENV{$1}/' composer.json | ||
COMPOSER_MEMORY_LIMIT=-1 composer install --no-interaction --prefer-dist | ||
} | ||
|
||
case "${TEST}" in | ||
PHPCodeSniffer) | ||
cd ${TRAVIS_BUILD_DIR} | ||
composer install | ||
./vendor/bin/phpcs | ||
exit $? | ||
;; | ||
PHPStan) | ||
# Deploy the codebase. | ||
install_codebase | ||
cp ${TRAVIS_BUILD_DIR}/tests/travis-ci/fixtures/phpstan.neon.dist ${SITE_DIR}/phpstan.neon | ||
|
||
# Run static analysis. | ||
./vendor/bin/phpstan analyse ./web/modules/sparql_entity_storage | ||
exit $? | ||
;; | ||
PHPUnit) | ||
# Deploy the codebase. | ||
install_codebase | ||
|
||
# Setup PHPUnit. | ||
cp ${TRAVIS_BUILD_DIR}/tests/travis-ci/fixtures/phpunit.xml.dist ${SITE_DIR}/phpunit.xml | ||
|
||
# Virtuoso setup. | ||
mkdir ${SITE_DIR}/virtuoso | ||
docker run --name virtuoso -p 8890:8890 -p 1111:1111 -e SPARQL_UPDATE=true -v ${SITE_DIR}/virtuoso:/data -d tenforce/virtuoso | ||
|
||
# Sleep to ensure that docker services are available. | ||
sleep 15 | ||
|
||
# Create the MySQL database. | ||
mysql -e 'CREATE DATABASE sparql_entity_storage_test' | ||
mysql -e 'CREATE DATABASE sparql_entity_storage_test_phpunit' | ||
|
||
# Install Drupal. | ||
./vendor/bin/drush site:install testing --yes --root=${SITE_DIR}/web --db-url=mysql://root:@127.0.0.1/sparql_entity_storage_test | ||
|
||
# Add the SPARQL connection to settings.php. | ||
chmod 0775 ${SITE_DIR}/web/sites/default/settings.php | ||
cat ${TRAVIS_BUILD_DIR}/tests/travis-ci/fixtures/connection.txt >> ${SITE_DIR}/web/sites/default/settings.php | ||
|
||
# Enable the 'rdf_entity' module. | ||
./vendor/bin/drush pm:enable sparql_entity_storage --yes --root=${SITE_DIR}/web | ||
|
||
# Start the webserver for browser tests. | ||
cd ${SITE_DIR}/web | ||
nohup php -S localhost:8888 > /dev/null 2>&1 & | ||
|
||
# Wait until the web server is responding. | ||
until curl -s localhost:8888; do true; done > /dev/null | ||
|
||
# Run PHPUnit. | ||
cd .. | ||
./vendor/bin/phpunit --verbose | ||
exit $? | ||
;; | ||
*) | ||
echo "Unknown test '$1'" | ||
exit 1 | ||
esac |