Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 31 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
language: php
sudo: false

php:
- 5.6
- 7.0
- 7.1
- 7.2

matrix:
fast_finish: true
include:
- env: DRUPAL=8.5.x
php: 5.5
- env: DRUPAL=8.5.x
php: 5.6
- env: DRUPAL=8.5.x
php: 7.1
- env: DRUPAL=8.5.x
php: 7.2
- env: DRUPAL=8.6.x
php: 5.5
- env: DRUPAL=8.6.x
php: 5.6
- env: DRUPAL=8.6.x
php: 7.1
- env: DRUPAL=8.6.x
php: 7.2
# Run the coding standards check only once.
exclude:
- php: 5.6
env: TEST_SUITE=PHP_CodeSniffer
- php: 7.0
env: TEST_SUITE=PHP_CodeSniffer
- php: 7.1
env: TEST_SUITE=PHP_CodeSniffer

addons:
hosts:
Expand All @@ -39,6 +36,10 @@ env:
# add composer's global bin directory to the path
# see: https://github.com/drush-ops/drush#install---composer
- PATH="$PATH:$HOME/.composer/vendor/bin"
matrix:
- TEST_SUITE=8.5.x
- TEST_SUITE=8.6.x
- TEST_SUITE=PHP_CodeSniffer

mysql:
database: domain
Expand Down Expand Up @@ -69,36 +70,30 @@ before_script:

# Remember the current rules test directory for later use in the Drupal installation.
- TESTDIR=$(pwd)
# Remember the Drupal installation path.
- DRUPAL_DIR=$(pwd)/drupal
# Navigate out of module directory to prevent blown stack by recursive module lookup.
- cd ..

# Download Drupal 8 core.
- travis_retry drush dl drupal-$DRUPAL --drupal-project-rename=drupal
- cd drupal
- test ${TEST_SUITE} == "PHP_CodeSniffer" || travis_retry drush dl drupal-$DRUPAL --drupal-project-rename=drupal
- test ${TEST_SUITE} == "PHP_CodeSniffer" || cd drupal

# Update PHPUnit.
- composer run-script drupal-phpunit-upgrade
- test ${TEST_SUITE} == "PHP_CodeSniffer" || composer run-script drupal-phpunit-upgrade

# Make the module appear in the correct place
- ln -s $TESTDIR modules/domain
- test ${TEST_SUITE} == "PHP_CodeSniffer" || ln -s $TESTDIR modules/domain

# Install drupal default profile
- /usr/bin/env PHP_OPTIONS="-d sendmail_path=$(which true)" drush --yes --verbose site-install minimal --db-url=mysql://root:@127.0.0.1/domain
- drush --yes en simpletest domain domain_access domain_alias domain_config domain_source
- drush cr
- test ${TEST_SUITE} == "PHP_CodeSniffer" || /usr/bin/env PHP_OPTIONS="-d sendmail_path=$(which true)" drush --yes --verbose site-install minimal --db-url=mysql://root:@127.0.0.1/domain
- test ${TEST_SUITE} == "PHP_CodeSniffer" || drush --yes en simpletest domain domain_access domain_alias domain_config domain_source
- test ${TEST_SUITE} == "PHP_CodeSniffer" || drush cr

# Start a web server on port 8080 in the background.
- nohup php -S 0.0.0.0:8080 > /dev/null 2>&1 &
- test ${TEST_SUITE} == "PHP_CodeSniffer" || nohup php -S 0.0.0.0:8080 > /dev/null 2>&1 &

# Wait until the web server is responding.
- until curl -s example.com:8080; do true; done > /dev/null

script:
- php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain
- php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Kernel" --php `which php` --url http://example.com:8080 domain
- php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_access
- php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_alias
- php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Kernel" --php `which php` --url http://example.com:8080 domain_alias
- php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_config
- php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_content
- php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_source
- test ${TEST_SUITE} == "PHP_CodeSniffer" || until curl -s example.com:8080; do true; done > /dev/null

script: DRUPAL_DIR=$DRUPAL_DIR TESTDIR=$TESTDIR $TESTDIR/scripts/travis-ci/run-test.sh $TEST_SUITE
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?php

/**
* Implements hook_domain_source_path_alter()
* @file
* Hook implementations for this module.
*/

/**
* Implements hook_domain_source_path_alter().
*/
function domain_source_test_domain_source_alter(&$source, $path, $options) {
// Always make our test REST links go to the primary domain.
Expand Down
15 changes: 13 additions & 2 deletions domain_source/tests/src/Functional/DomainSourceContentUrlsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ class DomainSourceContentUrlsTest extends DomainTestBase {
*
* @var array
*/
public static $modules = ['domain', 'domain_access', 'domain_source', 'field', 'node', 'user'];
public static $modules = [
'domain',
'domain_access',
'domain_source',
'field',
'node',
'user',
];

/**
* {@inheritdoc}
Expand All @@ -39,7 +46,11 @@ public function testDomainSourceUrls() {
$nodes_values = [
'type' => 'page',
'title' => 'foo',
DOMAIN_ACCESS_FIELD => ['example_com', 'one_example_com', 'two_example_com'],
DOMAIN_ACCESS_FIELD => [
'example_com',
'one_example_com',
'two_example_com',
],
DOMAIN_ACCESS_ALL_FIELD => 0,
DOMAIN_SOURCE_FIELD => $id,
];
Expand Down
18 changes: 16 additions & 2 deletions domain_source/tests/src/Functional/DomainSourceParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ class DomainSourceParameterTest extends DomainTestBase {
*
* @var array
*/
public static $modules = array('domain', 'domain_source', 'domain_source_test', 'field', 'node', 'user');
public static $modules = [
'domain',
'domain_source',
'domain_source_test',
'field',
'node',
'user',
];

/**
* {@inheritdoc}
Expand All @@ -29,11 +36,18 @@ protected function setUp() {
DomainTestBase::domainCreateTestDomains(3);
}

/**
* Tests domain source URLs.
*/
public function testDomainSourceUrls() {
// Create a node, assigned to a source domain.
$id = 'example_com';

$node = $this->createNode(['type' => 'page', 'title' => 'foo', DOMAIN_SOURCE_FIELD => $id]);
$this->createNode([
'type' => 'page',
'title' => 'foo',
DOMAIN_SOURCE_FIELD => $id,
]);

// Variables for our tests.
$path = 'domain-format-test';
Expand Down
13 changes: 13 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?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>

<rule ref="./vendor/drupal/coder/coder_sniffer/Drupal">
<!-- Disabled rules -->
<exclude name="Drupal.InfoFiles.AutoAddedKeys"/>
<exclude name="Drupal.Files.TxtFileLineLength"/>
</rule>
<exclude-pattern>./vendor</exclude-pattern>
</ruleset>
23 changes: 23 additions & 0 deletions scripts/travis-ci/run-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Run either PHPUnit tests or PHP_CodeSniffer tests on Travis CI, depending
# on the passed in parameter.

TEST_DIRS=($MODULE_DIR/domain/tests $MODULE_DIR/domain_access/tests $MODULE_DIR/domain_alias/tests $MODULE_DIR/domain_config/tests $MODULE_DIR/domain_content/tests $MODULE_DIR/domain_source/tests)

case "$1" in
PHP_CodeSniffer)
cd $MODULE_DIR
composer install
./vendor/bin/phpcs
exit $?
;;
*)
cd $DRUPAL_DIR
EXIT=0
for i in ${TEST_DIRS[@]}; do
echo " > Executing tests from $i"
php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --php `which php` --url http://example.com:8080 $i || EXIT=1
done
exit $EXIT
esac