Skip to content

Commit

Permalink
Merge pull request #23 from LionsAd/phpunit-core
Browse files Browse the repository at this point in the history
Add new phpunit-core runner for Drupal 8.
  • Loading branch information
LionsAd committed Jul 18, 2015
2 parents e114388 + 6d79d4f commit 3683674
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 5 deletions.
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ matrix:
exclude:
# Drupal-8 does not work on PHP 5.3 or PHP 5.4.
- php: 5.3
env: DRUPAL_TI_RUNNERS="test phpunit simpletest behat" DRUPAL_TI_ENVIRONMENT="drupal-8" DRUPAL_TI_SAVE_CACHE="0"
env: DRUPAL_TI_RUNNERS="test phpunit phpunit-core simpletest behat" DRUPAL_TI_ENVIRONMENT="drupal-8" DRUPAL_TI_SAVE_CACHE="0"
- php: 5.4
env: DRUPAL_TI_RUNNERS="test phpunit simpletest behat" DRUPAL_TI_ENVIRONMENT="drupal-8" DRUPAL_TI_SAVE_CACHE="0"
env: DRUPAL_TI_RUNNERS="test phpunit phpunit-core simpletest behat" DRUPAL_TI_ENVIRONMENT="drupal-8" DRUPAL_TI_SAVE_CACHE="0"
include:
# Test single runners on PHP 5.4.
- php: 5.4
Expand All @@ -52,6 +52,9 @@ matrix:
env: DRUPAL_TI_BEHAT_DRIVER="selenium" DRUPAL_TI_BEHAT_BROWSER="firefox" DRUPAL_TI_RUNNERS="behat" DRUPAL_TI_ENVIRONMENT="drupal-7" DRUPAL_TI_SAVE_CACHE="0"
- php: 5.4
env: DRUPAL_TI_BEHAT_DRIVER="selenium" DRUPAL_TI_BEHAT_BROWSER="chrome" DRUPAL_TI_RUNNERS="behat" DRUPAL_TI_ENVIRONMENT="drupal-7" DRUPAL_TI_SAVE_CACHE="0"
# Test phpunit-core in isolation.
- php: 5.5
env: DRUPAL_TI_RUNNERS="phpunit-core" DRUPAL_TI_ENVIRONMENT="drupal-8" DRUPAL_TI_SAVE_CACHE="0"
# Test working hhvm tests.
- php: hhvm
env: DRUPAL_TI_RUNNERS="phpunit behat" DRUPAL_TI_ENVIRONMENT="drupal-8" DRUPAL_TI_SAVE_CACHE="0"
Expand Down Expand Up @@ -104,6 +107,10 @@ env:

# PHPUnit specific commandline arguments.
- DRUPAL_TI_PHPUNIT_ARGS=""
# Specifying the phpunit-core src/ directory is useful when e.g. a vendor/
# directory is present in the module directory, which phpunit would then
# try to find tests in. This option is relative to $TRAVIS_BUILD_DIR.
- DRUPAL_TI_PHPUNIT_CORE_SRC_DIRECTORY="./tests/src"

# Code coverage via coveralls.io
- DRUPAL_TI_COVERAGE="satooshi/php-coveralls:0.6.*"
Expand Down Expand Up @@ -136,7 +143,7 @@ env:
#- DRUPAL_TI_RUNNERS="behat" DRUPAL_TI_ENVIRONMENT="drupal-7"
# And in combination.
- DRUPAL_TI_RUNNERS="test phpunit simpletest behat" DRUPAL_TI_ENVIRONMENT="drupal-7"
- DRUPAL_TI_RUNNERS="test phpunit simpletest behat" DRUPAL_TI_ENVIRONMENT="drupal-8" DRUPAL_TI_SAVE_CACHE="0"
- DRUPAL_TI_RUNNERS="test phpunit phpunit-core simpletest behat" DRUPAL_TI_ENVIRONMENT="drupal-8" DRUPAL_TI_SAVE_CACHE="0"

mysql:
database: drupal_travis_db
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ env:

# PHPUnit specific commandline arguments.
- DRUPAL_TI_PHPUNIT_ARGS=""
# Specifying the phpunit-core src/ directory is useful when e.g. a vendor/
# directory is present in the module directory, which phpunit would then
# try to find tests in. This option is relative to $TRAVIS_BUILD_DIR.
- DRUPAL_TI_PHPUNIT_CORE_SRC_DIRECTORY="./tests/src"

# Code coverage via coveralls.io
- DRUPAL_TI_COVERAGE="satooshi/php-coveralls:0.6.*"
Expand Down
10 changes: 10 additions & 0 deletions runners/phpunit-core/before_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
# Simple script to install drupal for travis-ci running.

set -e $DRUPAL_TI_DEBUG

# Ensure the right Drupal version is installed.
drupal_ti_ensure_drupal

# Ensure the module is linked into the code base and enabled.
drupal_ti_ensure_module
7 changes: 7 additions & 0 deletions runners/phpunit-core/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# Simple script to install dependencies for travis-ci running.

set -e $DRUPAL_TI_DEBUG

# Ensure that drush is installed.
drupal_ti_ensure_drush
14 changes: 14 additions & 0 deletions runners/phpunit-core/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# @file
# Simple script to run the core phpunit tests via travis-ci.

cd "$DRUPAL_TI_DRUPAL_DIR"

# Find absolute path to modules directory.
MODULE_DIR=$(cd "$DRUPAL_TI_MODULES_PATH"; pwd)

ARGS=( $DRUPAL_TI_PHPUNIT_ARGS )

# Run core tests
cd core
./vendor/bin/phpunit "${ARGS[@]}" "$MODULE_DIR/$DRUPAL_TI_MODULE_NAME/$DRUPAL_TI_PHPUNIT_CORE_SRC_DIRECTORY"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class DrupalTiTestTest extends \PHPUnit_Framework_TestCase {

/**
* @covers ::bar()
* @covers ::bar
*/
public function test_bar() {
$test = new DrupalTiTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class DrupalTiTestTest extends \PHPUnit_Framework_TestCase {

/**
* @covers ::bar()
* @covers ::bar
*/
public function test_bar() {
$test = new DrupalTiTest();
Expand Down

0 comments on commit 3683674

Please sign in to comment.