diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..e679c8bf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,66 @@ +language: php + +php: + - 7.1 + - 7.2 + +sudo: false + +mysql: + database: rdf_entity_test + username: root + encoding: utf8 + +env: + global: + - SITE_DIR="$HOME/build/testing_site" + matrix: + - TEST=PHP_CodeSniffer + - TEST=PHPUnit + +matrix: + fast_finish: true + exclude: + - php: 7.2 + env: TEST=PHP_CodeSniffer + +before_install: + - composer --verbose self-update + - mkdir -p ${SITE_DIR}/web/modules + - cd ${SITE_DIR} + + ### PHP_CodeSniffer only. + + # We only need the PHP Code Sniffer (and the Drupal coder). + - test ${TEST} == "PHPUnit" || composer require drupal/coder + + ### PHPUnit only (till the end). + + # Deploy the codebase. + - test ${TEST} == "PHP_CodeSniffer" || cp ${TRAVIS_BUILD_DIR}/tests/travis-ci/fixtures/composer.json.dist ${SITE_DIR}/composer.json + - test ${TEST} == "PHP_CodeSniffer" || cp ${TRAVIS_BUILD_DIR}/tests/travis-ci/fixtures/phpunit.xml.dist ${SITE_DIR}/web/phpunit.xml + - test ${TEST} == "PHP_CodeSniffer" || sed -i -e 's#\$TRAVIS_BUILD_DIR#'${TRAVIS_BUILD_DIR}'#g' composer.json + - test ${TEST} == "PHP_CodeSniffer" || composer install --no-interaction + # Virtuoso setup. + - test ${TEST} == "PHP_CodeSniffer" || mkdir ${SITE_DIR}/virtuoso + - test ${TEST} == "PHP_CodeSniffer" || docker run --name virtuoso -p 8890:8890 -p 1111:1111 -e SPARQL_UPDATE=true -v ${SITE_DIR}/virtuoso:/data -d tenforce/virtuoso + # Create the MySQL database. + - test ${TEST} == "PHP_CodeSniffer" || mysql -e 'CREATE DATABASE rdf_entity_test' + # Install Drupal. + - test ${TEST} == "PHP_CodeSniffer" || ./vendor/bin/drush site:install testing --yes --root=${SITE_DIR}/web --db-url=mysql://root:@127.0.0.1/rdf_entity_test + # Add the SPARQL connection to settings.php. + - test ${TEST} == "PHP_CodeSniffer" || chmod 0775 ${SITE_DIR}/web/sites/default/settings.php + - test ${TEST} == "PHP_CodeSniffer" || cat ${TRAVIS_BUILD_DIR}/tests/travis-ci/fixtures/connection.txt >> ${SITE_DIR}/web/sites/default/settings.php + # Enable the 'rdf_entity' module. + - test ${TEST} == "PHP_CodeSniffer" || ./vendor/bin/drush pm:enable rdf_entity --yes --root=${SITE_DIR}/web + # Start the webserver for browser tests. + - cd ${SITE_DIR}/web + - test ${TEST} == "PHP_CodeSniffer" || nohup php -S localhost:8888 > /dev/null 2>&1 & + # Wait until the web server is responding. + - test ${TEST} == "PHP_CodeSniffer" || until curl -s localhost:8888; do true; done > /dev/null + - cd .. + +script: ${TRAVIS_BUILD_DIR}/tests/travis-ci/scripts/run_tests ${TEST} + +notifications: + email: false diff --git a/README.md b/README.md index 60364535..8ca23298 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/ec-europa/rdf_entity.svg?branch=8.x-1.x)](https://travis-ci.org/ec-europa/rdf_entity) + # Getting started A working Sparql endpoint is needed to use the rdf entity module. You could either use a remote Sparql endpoint, or you could set one up locally. diff --git a/composer.json b/composer.json index 61719f40..c7a4c54e 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,5 @@ "require": { "php": ">=7.1", "easyrdf/easyrdf": "0.10.0-alpha.1 as 0.9.2" - }, - "require-dev": { - "minimaxir/big-list-of-naughty-strings": "dev-master" } } diff --git a/modules/rdf_taxonomy/tests/src/Kernel/SparqlTaxonomyTest.php b/modules/rdf_taxonomy/tests/src/Kernel/SparqlTaxonomyTest.php index 4f26d475..a31a0958 100644 --- a/modules/rdf_taxonomy/tests/src/Kernel/SparqlTaxonomyTest.php +++ b/modules/rdf_taxonomy/tests/src/Kernel/SparqlTaxonomyTest.php @@ -4,7 +4,7 @@ use Drupal\rdf_entity\Entity\Rdf; use Drupal\taxonomy\Entity\Term; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; +use Drupal\Tests\rdf_entity\Kernel\RdfKernelTestBase; /** * Tests Entity Query functionality of the Sparql backend. @@ -13,7 +13,7 @@ * * @group Entity */ -class SparqlTaxonomyTest extends JoinupKernelTestBase { +class SparqlTaxonomyTest extends RdfKernelTestBase { /** * Modules to enable. @@ -22,7 +22,6 @@ class SparqlTaxonomyTest extends JoinupKernelTestBase { */ public static $modules = [ 'field_test', - 'datetime', 'language', 'rdf_taxonomy', 'rdf_taxonomy_test', diff --git a/rdf_entity.module b/rdf_entity.module index d32152ba..4484790e 100755 --- a/rdf_entity.module +++ b/rdf_entity.module @@ -11,8 +11,6 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase; use Drupal\Core\Config\Entity\ConfigEntityInterface; use Drupal\Core\Database\Database; use Drupal\Core\Entity\BundleEntityFormBase; -use Drupal\Core\Entity\ContentEntityInterface; -use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Form\FormStateInterface; @@ -23,7 +21,6 @@ use Drupal\field\FieldStorageConfigInterface; use Drupal\rdf_entity\Entity\RdfEntityMapping; use Drupal\rdf_entity\Entity\RdfEntitySparqlStorage; use Drupal\rdf_entity\RdfEntityGraphInterface; -use Drupal\rdf_entity\RdfEntitySparqlStorageInterface; use Drupal\rdf_entity\RdfFieldHandler; use Drupal\rdf_entity\RdfInterface; use EasyRdf\Http; diff --git a/src/Entity/Query/Sparql/Query.php b/src/Entity/Query/Sparql/Query.php index 585cb377..33d3854a 100644 --- a/src/Entity/Query/Sparql/Query.php +++ b/src/Entity/Query/Sparql/Query.php @@ -196,7 +196,6 @@ protected function prepare() { } $this->query .= "\n"; - if (!$this->graphIds) { // If no graph IDs were requested, allow all graphs that Drupal is aware // for this entity type. diff --git a/src/Entity/Query/Sparql/SparqlCondition.php b/src/Entity/Query/Sparql/SparqlCondition.php index 10dfbb2e..28f386cc 100644 --- a/src/Entity/Query/Sparql/SparqlCondition.php +++ b/src/Entity/Query/Sparql/SparqlCondition.php @@ -28,7 +28,7 @@ class SparqlCondition extends ConditionFundamentals implements ConditionInterfac '>=', '<>', 'IN', - 'NOT IN' + 'NOT IN', ]; /** diff --git a/src/Entity/RdfEntitySparqlStorage.php b/src/Entity/RdfEntitySparqlStorage.php index 340a2f82..2c9615d3 100644 --- a/src/Entity/RdfEntitySparqlStorage.php +++ b/src/Entity/RdfEntitySparqlStorage.php @@ -10,7 +10,6 @@ use Drupal\Core\Entity\ContentEntityStorageBase; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Entity\EntityPublishedInterface; use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; @@ -23,7 +22,6 @@ use Drupal\rdf_entity\Exception\DuplicatedIdException; use Drupal\rdf_entity\RdfEntityIdPluginManager; use Drupal\rdf_entity\RdfEntitySparqlStorageInterface; -use Drupal\rdf_entity\RdfFieldHandler; use Drupal\rdf_entity\RdfFieldHandlerInterface; use Drupal\rdf_entity\RdfGraphHandlerInterface; use EasyRdf\Graph; diff --git a/src/Form/RdfFieldStorageConfigEditForm.php b/src/Form/RdfFieldStorageConfigEditForm.php index f18281c2..95223ff9 100644 --- a/src/Form/RdfFieldStorageConfigEditForm.php +++ b/src/Form/RdfFieldStorageConfigEditForm.php @@ -2,7 +2,6 @@ namespace Drupal\rdf_entity\Form; -use Drupal\Core\Form\FormStateInterface; use Drupal\field_ui\Form\FieldStorageConfigEditForm; use Drupal\rdf_entity\Entity\RdfEntitySparqlStorage; diff --git a/src/RdfEntitySparqlStorageInterface.php b/src/RdfEntitySparqlStorageInterface.php index 8dbc5d3a..10001e43 100644 --- a/src/RdfEntitySparqlStorageInterface.php +++ b/src/RdfEntitySparqlStorageInterface.php @@ -149,7 +149,7 @@ public function loadByProperties(array $values = [], array $graph_ids = NULL): a /** * Resets the internal, static entity cache. * - * @param $ids + * @param array|null $ids * (optional) If specified, the cache is reset for the entities with the * given ids only. * @param string[]|null $graph_ids diff --git a/src/RdfFieldHandler.php b/src/RdfFieldHandler.php index 23695167..ea51382e 100644 --- a/src/RdfFieldHandler.php +++ b/src/RdfFieldHandler.php @@ -18,76 +18,80 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** - * Contains helper methods that help with the uri mappings of Drupal elements. + * Contains helper methods that help with the URI mappings of Drupal elements. + * + * Mainly, two field maps are created and statically cached: + * + * The OUTBOUND MAP, witch is a Drupal oriented property mapping array. A YAML + * representation of this array would look like: + * @codingStandardsIgnoreStart + * rdf_entity: + * bundle_key: rid + * bundles: + * catalog: http://www.w3.org/ns/dcat#Catalog + * other_bundle: ... + * fields: + * label: + * main_property: value + * columns: + * value: + * catalog: + * predicate: http://purl.org/dc/terms/title + * format: t_literal + * serialize: false + * data_type: string + * other_bundle: + * predicate: ... + * ... + * other_column: + * catalog: + * ... + * other_field: ... + * other_entity_type: + * bundle_key: ... + * ... + * @codingStandardsIgnoreEnd + * + * The INBOUND MAP, witch is a SPARQL oriented property mapping array. A YAML + * representation of this array would look like: + * @codingStandardsIgnoreStart + * rdf_entity: + * bundle_key: rid + * bundles: + * http://www.w3.org/ns/dcat#Catalog: + * - catalog + * - collection + * http://example.com: + * - other_bundle + * fields: + * http://purl.org/dc/terms/title: + * catalog: + * field_name: label + * column: value + * serialize: false + * type: string + * data_type: string + * other_field: + * field_name: ... + * ... + * http://example.com/field_mapping: + * .... + * other_entity_type: + * bundle_key: ... + * ... + * @codingStandardsIgnoreEnd */ class RdfFieldHandler implements RdfFieldHandlerInterface { /** - * A Drupal oriented property mapping array. - * - * A YAML representation of this array would look like: - * @code - * rdf_entity: - * bundle_key: rid - * bundles: - * catalog: http://www.w3.org/ns/dcat#Catalog - * other_bundle: ... - * fields: - * label: - * main_property: value - * columns: - * value: - * catalog: - * predicate: http://purl.org/dc/terms/title - * format: t_literal - * serialize: false - * data_type: string - * other_bundle: - * predicate: ... - * ... - * other_column: - * catalog: - * ... - * other_field: ... - * other_entity_type: - * bundle_key: ... - * ... - * @endcode + * The static cache of outbound map. * * @var array */ protected $outboundMap; /** - * A SPARQL oriented property mapping array. - * - * A YAML representation of this array would look like: - * @code - * rdf_entity: - * bundle_key: rid - * bundles: - * http://www.w3.org/ns/dcat#Catalog: - * - catalog - * - collection - * http://example.com: - * - other_bundle - * fields: - * http://purl.org/dc/terms/title: - * catalog: - * field_name: label - * column: value - * serialize: false - * type: string - * data_type: string - * other_field: - * field_name: ... - * ... - * http://example.com/field_mapping: - * .... - * other_entity_type: - * bundle_key: ... - * ... - * @endcode + * The static cache of inbound map. * * @var array */ diff --git a/tests/src/Functional/RdfWebTestBase.php b/tests/src/Functional/RdfWebTestBase.php deleted file mode 100644 index 4b50f668..00000000 --- a/tests/src/Functional/RdfWebTestBase.php +++ /dev/null @@ -1,54 +0,0 @@ -setUpSparql(); - parent::setUp(); - } - - /** - * {@inheritdoc} - */ - public function tearDown() { - // Delete all data produced by testing module. - foreach ($this->usedGraphs as $graph) { - $query = << { - ?entity ?field ?value - } -} -WHERE { - GRAPH <$graph> { - ?entity ?field ?value - } -} -EndOfQuery; - $this->sparql->query($query); - } - - parent::tearDown(); - } - -} diff --git a/tests/src/Kernel/RdfDateFieldsTest.php b/tests/src/Kernel/RdfDateFieldsTest.php index 50e414bd..9c3f4b35 100644 --- a/tests/src/Kernel/RdfDateFieldsTest.php +++ b/tests/src/Kernel/RdfDateFieldsTest.php @@ -4,14 +4,13 @@ use Drupal\rdf_entity\Entity\Query\Sparql\SparqlArg; use Drupal\rdf_entity\Entity\Rdf; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; /** * Tests date fields in rdf entities. * * @group rdf_entity */ -class RdfDateFieldsTest extends JoinupKernelTestBase { +class RdfDateFieldsTest extends RdfKernelTestBase { /** * Tests handling of timestamp field properties. diff --git a/tests/src/Kernel/RdfEncodingTest.php b/tests/src/Kernel/RdfEncodingTest.php index 7b3fbb66..e056aa09 100644 --- a/tests/src/Kernel/RdfEncodingTest.php +++ b/tests/src/Kernel/RdfEncodingTest.php @@ -3,14 +3,13 @@ namespace Drupal\Tests\rdf_entity\Kernel; use Drupal\rdf_entity\Entity\Rdf; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; /** * Tests the support of saving various encoded stings in the triple store. * * @group rdf_entity */ -class RdfEncodingTest extends JoinupKernelTestBase { +class RdfEncodingTest extends RdfKernelTestBase { /** * Test that naughty strings can safely be saved to the database. @@ -18,8 +17,12 @@ class RdfEncodingTest extends JoinupKernelTestBase { public function testEncoding() { $path = DRUPAL_ROOT . "/../vendor/minimaxir/big-list-of-naughty-strings/blns.json"; if (!file_exists($path)) { - $this->markTestSkipped('Library minimaxir/big-list-of-naughty-strings is required.'); - return; + // Retry with the vendor directory in the Drupal root. + $path = DRUPAL_ROOT . "/vendor/minimaxir/big-list-of-naughty-strings/blns.json"; + if (!file_exists($path)) { + $this->markTestSkipped('Library minimaxir/big-list-of-naughty-strings is required.'); + return; + } } $json = file_get_contents($path); $naughty_strings = json_decode($json); diff --git a/tests/src/Kernel/RdfEntityCacheTest.php b/tests/src/Kernel/RdfEntityCacheTest.php index dd4d9e31..91d30497 100644 --- a/tests/src/Kernel/RdfEntityCacheTest.php +++ b/tests/src/Kernel/RdfEntityCacheTest.php @@ -4,14 +4,13 @@ use Drupal\Core\Cache\Cache; use Drupal\rdf_entity\Entity\Rdf; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; /** * Tests RDF entity caching. * * @group rdf_entity */ -class RdfEntityCacheTest extends JoinupKernelTestBase { +class RdfEntityCacheTest extends RdfKernelTestBase { /** * Tests RDF entity cache tags. diff --git a/tests/src/Kernel/RdfEntityCreationTest.php b/tests/src/Kernel/RdfEntityCreationTest.php index 88237c79..ea42f009 100644 --- a/tests/src/Kernel/RdfEntityCreationTest.php +++ b/tests/src/Kernel/RdfEntityCreationTest.php @@ -4,7 +4,6 @@ use Drupal\rdf_entity\Entity\Rdf; use Drupal\rdf_entity\Exception\DuplicatedIdException; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; /** * Provides unit testing for the 'rdf_entity' entity. @@ -13,7 +12,7 @@ * * @group rdf_entity */ -class RdfEntityCreationTest extends JoinupKernelTestBase { +class RdfEntityCreationTest extends RdfKernelTestBase { /** * Tests overlapping IDs. diff --git a/tests/src/Kernel/RdfEntityLanguageTestBase.php b/tests/src/Kernel/RdfEntityLanguageTestBase.php index 33e2b5ea..bbf9a9fd 100644 --- a/tests/src/Kernel/RdfEntityLanguageTestBase.php +++ b/tests/src/Kernel/RdfEntityLanguageTestBase.php @@ -42,8 +42,6 @@ abstract class RdfEntityLanguageTestBase extends RdfKernelTestBase { */ public static $modules = [ 'language', - 'datetime', - 'rdf_entity_test', ]; /** @@ -53,7 +51,6 @@ protected function setUp() { parent::setUp(); $this->installEntitySchema('user'); - $this->installConfig(['rdf_entity_test']); $this->languageManager = $this->container->get('language_manager'); $this->installConfig(['language']); // Enable translations for the rdf entity. diff --git a/tests/src/Kernel/RdfKernelTestBase.php b/tests/src/Kernel/RdfKernelTestBase.php index 26a730b9..bafb5be7 100644 --- a/tests/src/Kernel/RdfKernelTestBase.php +++ b/tests/src/Kernel/RdfKernelTestBase.php @@ -6,7 +6,7 @@ use Drupal\Tests\rdf_entity\Traits\RdfDatabaseConnectionTrait; /** - * A base class for the rdf tests. + * A base class for the RDF tests. * * Sets up the SPARQL database connection. */ @@ -14,17 +14,50 @@ abstract class RdfKernelTestBase extends EntityKernelTestBase { use RdfDatabaseConnectionTrait; + /** + * {@inheritdoc} + */ + public static $modules = [ + 'datetime', + 'rdf_draft', + 'rdf_entity', + 'rdf_entity_test', + ]; + /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->setUpSparql(); - - $this->installModule('rdf_entity'); - $this->installModule('rdf_draft'); - $this->installConfig(['rdf_entity', 'rdf_draft']); + $this->installConfig(['rdf_entity', 'rdf_draft', 'rdf_entity_test']); $this->installEntitySchema('rdf_entity'); } + /** + * {@inheritdoc} + */ + public function tearDown() { + // Delete all data produced by testing module. + foreach (['dummy', 'with_owner', 'multifield'] as $bundle) { + foreach (['published', 'draft'] as $graph) { + $query = << { + ?entity ?field ?value + } +} +WHERE { + GRAPH { + ?entity ?field ?value + } +} +EndOfQuery; + $this->sparql->query($query); + } + } + + parent::tearDown(); + } + } diff --git a/tests/src/Kernel/RdfOwnerTest.php b/tests/src/Kernel/RdfOwnerTest.php index fb44cd63..787e8634 100644 --- a/tests/src/Kernel/RdfOwnerTest.php +++ b/tests/src/Kernel/RdfOwnerTest.php @@ -3,14 +3,13 @@ namespace Drupal\Tests\rdf_entity\Kernel; use Drupal\rdf_entity\Entity\Rdf; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; /** * Tests rdf_entity owner functionality. * * @group rdf_entity */ -class RdfOwnerTest extends JoinupKernelTestBase { +class RdfOwnerTest extends RdfKernelTestBase { /** * Tests rdf_entity owner functionality. diff --git a/tests/src/Kernel/RdfQueryExceptionTest.php b/tests/src/Kernel/RdfQueryExceptionTest.php index 1b703825..cb1c88b7 100644 --- a/tests/src/Kernel/RdfQueryExceptionTest.php +++ b/tests/src/Kernel/RdfQueryExceptionTest.php @@ -3,14 +3,13 @@ namespace Drupal\Tests\rdf_entity\Kernel; use Drupal\rdf_entity\Exception\SparqlQueryException; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; /** * Test that a proper exception is thrown when a query fails. * * @group rdf_entity */ -class RdfQueryExceptionTest extends JoinupKernelTestBase { +class RdfQueryExceptionTest extends RdfKernelTestBase { /** * Exception with query in message thrown for selects. diff --git a/tests/src/Kernel/SparqlEntityInsertTest.php b/tests/src/Kernel/SparqlEntityInsertTest.php index 05a281ac..b2e721d5 100644 --- a/tests/src/Kernel/SparqlEntityInsertTest.php +++ b/tests/src/Kernel/SparqlEntityInsertTest.php @@ -5,14 +5,13 @@ use Drupal\Component\Utility\Random; use Drupal\rdf_entity\Entity\Rdf; use Drupal\rdf_entity\RdfInterface; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; /** * Tests Entity Query functionality of the Sparql backend. * - * @group Entity + * @group rdf_entity */ -class SparqlEntityInsertTest extends JoinupKernelTestBase { +class SparqlEntityInsertTest extends RdfKernelTestBase { /** * Modules to enable. @@ -21,7 +20,6 @@ class SparqlEntityInsertTest extends JoinupKernelTestBase { */ public static $modules = [ 'field_test', - 'datetime', 'language', ]; diff --git a/tests/src/Kernel/SparqlEntityQueryTest.php b/tests/src/Kernel/SparqlEntityQueryTest.php index 1f3a9df2..b5a14824 100644 --- a/tests/src/Kernel/SparqlEntityQueryTest.php +++ b/tests/src/Kernel/SparqlEntityQueryTest.php @@ -3,16 +3,15 @@ namespace Drupal\Tests\rdf_entity\Kernel; use Drupal\rdf_entity\Entity\Rdf; -use Drupal\Tests\joinup_core\Kernel\JoinupKernelTestBase; /** * Tests Entity Query functionality of the Sparql backend. * * @see \Drupal\KernelTests\Core\Entity\EntityQueryTest * - * @group Entity + * @group rdf_entity */ -class SparqlEntityQueryTest extends JoinupKernelTestBase { +class SparqlEntityQueryTest extends RdfKernelTestBase { /** * Modules to enable. @@ -21,7 +20,6 @@ class SparqlEntityQueryTest extends JoinupKernelTestBase { */ public static $modules = [ 'field_test', - 'datetime', 'language', ]; diff --git a/tests/travis-ci/fixtures/composer.json.dist b/tests/travis-ci/fixtures/composer.json.dist new file mode 100644 index 00000000..9489ab25 --- /dev/null +++ b/tests/travis-ci/fixtures/composer.json.dist @@ -0,0 +1,43 @@ +{ + "minimum-stability": "dev", + "prefer-stable": true, + "require": { + "php": ">=7.1.0", + "composer/installers": "^1.5.0", + "drupal-composer/drupal-scaffold": "dev-master", + "drupal/core": "~8", + "drupal/rdf_entity": "*", + "drush/drush": "~9", + "easyrdf/easyrdf": "0.10.0-alpha.1 as 0.9.2" + }, + "require-dev": { + "behat/mink-goutte-driver": "~1.2", + "drupal/coder": "^8.2.12", + "mikey179/vfsStream": "~1.2", + "minimaxir/big-list-of-naughty-strings": "dev-master", + "phpunit/phpunit": "~6.0" + }, + "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" + } + } + } + ], + "extra": { + "installer-paths": { + "web/core": ["type:drupal-core"], + "web/modules/{$name}": ["type:drupal-module"] + } + } +} diff --git a/tests/travis-ci/fixtures/connection.txt b/tests/travis-ci/fixtures/connection.txt new file mode 100644 index 00000000..32076a46 --- /dev/null +++ b/tests/travis-ci/fixtures/connection.txt @@ -0,0 +1,8 @@ + +$databases['sparql_default']['default'] = array ( + 'prefix' => '', + 'host' => '127.0.0.1', + 'port' => 8890, + 'namespace' => 'Drupal\\rdf_entity\\Database\\Driver\\sparql', + 'driver' => 'sparql', +); diff --git a/tests/travis-ci/fixtures/phpunit.xml.dist b/tests/travis-ci/fixtures/phpunit.xml.dist new file mode 100644 index 00000000..9dd932dd --- /dev/null +++ b/tests/travis-ci/fixtures/phpunit.xml.dist @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + ./modules/rdf_entity + + + + + diff --git a/tests/travis-ci/scripts/run_tests b/tests/travis-ci/scripts/run_tests new file mode 100755 index 00000000..90358260 --- /dev/null +++ b/tests/travis-ci/scripts/run_tests @@ -0,0 +1,18 @@ +#!/bin/bash + +case "$1" in + PHP_CodeSniffer) + cd ${SITE_DIR} + ./vendor/bin/phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer + ./vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt --ignore='*.md' ${TRAVIS_BUILD_DIR} + exit $? + ;; + PHPUnit) + cd ${SITE_DIR}/web + ../vendor/bin/phpunit + exit $? + ;; + *) + echo "Unknown test '$1'" + exit 1 +esac