Skip to content

Commit

Permalink
Merge pull request ezsystems#1199 from ezsystems/behat_testing
Browse files Browse the repository at this point in the history
Add light Behat testing to kernel repo
  • Loading branch information
andrerom committed Feb 20, 2015
2 parents 963f69b + 07c1259 commit 46e040a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 18 deletions.
32 changes: 14 additions & 18 deletions .travis.yml
Expand Up @@ -20,6 +20,7 @@ env:
- TEST_CONFIG="phpunit-integration-legacy.xml" DB="mysql" DATABASE="mysql://root@localhost/$DB_NAME"
- SOLR_VERSION="4.10.1" TEST_CONFIG="phpunit-integration-legacy-solr.xml"
- ELASTICSEARCH_VERSION="1.4.2" TEST_CONFIG="phpunit-integration-legacy-elasticsearch.xml"
- BEHAT_PROFILE="demo" TEST="clean"

matrix:
allow_failures:
Expand All @@ -39,14 +40,18 @@ matrix:
env: SOLR_VERSION="4.10.1" TEST_CONFIG="phpunit-integration-legacy-solr.xml"
- php: 5.4
env: ELASTICSEARCH_VERSION="1.4.2" TEST_CONFIG="phpunit-integration-legacy-elasticsearch.xml"
- php: 5.4
env: BEHAT_PROFILE="demo" TEST="clean"
# 5.5 run: unit test (Symfony 2.3) + mysql integration test + solr 4.x integration test
- php: 5.5
env: TEST_CONFIG="phpunit.xml"
- php: 5.5
env: TEST_CONFIG="phpunit-integration-legacy.xml" SYMFONY_VERSION="~2.6@beta"
- php: 5.5
env: TEST_CONFIG="phpunit-integration-legacy.xml" DB="postgresql" DATABASE="pgsql://postgres@localhost/$DB_NAME"
# 5.6 run: unit test + sqlite integration test
- php: 5.5
env: BEHAT_PROFILE="demo" TEST="clean"
# 5.6 run: unit test + sqlite integration test + behat test
- php: 5.6
env: TEST_CONFIG="phpunit.xml" SYMFONY_VERSION="~2.6@beta"
- php: 5.6
Expand All @@ -68,6 +73,8 @@ matrix:
env: SOLR_VERSION="4.10.1" TEST_CONFIG="phpunit-integration-legacy-solr.xml"
- php: hhvm
env: ELASTICSEARCH_VERSION="1.4.2" TEST_CONFIG="phpunit-integration-legacy-elasticsearch.xml"
- php: hhvm
env: BEHAT_PROFILE="demo" TEST="clean"

# test only master (+ Pull requests)
branches:
Expand All @@ -76,29 +83,18 @@ branches:

# setup requirements for running unit tests
before_script:
# TEMP get latests version of composer which is faster
- composer self-update
# Disable xdebug to speed things up as we don't currently generate coverge on travis
- if [ $TRAVIS_PHP_VERSION != "hhvm" ]; then phpenv config-rm xdebug.ini ; fi
# Setup DB
- if [ $DB == "mysql" ]; then mysql -e "CREATE DATABASE IF NOT EXISTS $DB_NAME;" -uroot ; fi
- if [ $DB == "postgresql" ]; then psql -c "CREATE DATABASE $DB_NAME;" -U postgres ; psql -c "CREATE EXTENSION pgcrypto;" -U postgres $DB_NAME ; fi
# Setup github key to avoid api rate limit
- ./composer_install_github_key.sh
# Switch to another Symfony version if asked for
- if [ $SYMFONY_VERSION != "" ]; then composer require --no-update symfony/symfony=$SYMFONY_VERSION; fi;
# Install packages using composer
- composer install --dev --prefer-dist
# Setup Solr / Elastic search if asked for
- if [ "$TEST_CONFIG" == "phpunit-integration-legacy-elasticsearch.xml" ] ; then ./bin/.travis/init_elasticsearch.sh ; fi
- "if [ \"$TEST_CONFIG\" = \"phpunit-integration-legacy-solr.xml\" ] ; then curl -L https://raw.github.com/andrerom/travis-solr/410/travis-solr.sh | SOLR_CONFS=eZ/Publish/Core/Search/Solr/Content/schema.xml bash ; fi"
# Prepare system
- if [ "$TEST_CONFIG" != "" ] ; then ./bin/.travis/prepare_unittest.sh ; fi
- if [ "$BEHAT_PROFILE" != "" ] ; then ./bin/.travis/prepare_behat.sh ; fi
# Detecting timezone issues by testing on random timezone
- TEST_TIMEZONES=("America/New_York" "Asia/Calcutta" "UTC")
- TEST_TIMEZONE=${TEST_TIMEZONES["`shuf -i 0-2 -n 1`"]}
- echo "$TEST_TIMEZONE"

# execute phpunit as the script command
script: "php -d date.timezone=$TEST_TIMEZONE -d memory_limit=-1 vendor/bin/phpunit -c $TEST_CONFIG"
script:
- if [ "$TEST_CONFIG" != "" ] ; then php -d date.timezone=$TEST_TIMEZONE -d memory_limit=-1 vendor/bin/phpunit -c $TEST_CONFIG ; fi
- if [ "$BEHAT_PROFILE" != "" ] ; then cd "$HOME/build/ezpublish-community" && php bin/behat -vv --profile $BEHAT_PROFILE --suite $TEST ; fi

# disable mail notifications
notification:
Expand Down
File renamed without changes.
26 changes: 26 additions & 0 deletions bin/.travis/prepare_behat.sh
@@ -0,0 +1,26 @@
#!/bin/sh

# File for setting up system for behat testing, just like done in DemoBundle's .travis.yml

export BRANCH_BUILD_DIR=$TRAVIS_BUILD_DIR
export TRAVIS_BUILD_DIR="$HOME/build/ezpublish-community"
cd "$HOME/build"

# Change the branch and/or remote to use a different ezpublish branch/distro
git clone --depth 1 --single-branch --branch master https://github.com/ezsystems/ezpublish-community.git
cd ezpublish-community

# Use this if you depend on another branch for a dependency (only works for the ezsystems remote)
# (note that packagist may take time to update the references, leading to errors. Just retrigger the build)
#
# Example:
# composer require --no-update ezsystems/DemoBundle:dev-MyCustomBranch

# Prepare system (Apache, Mysql, Sahi/Selenium, eZ Publish)
./bin/.travis/prepare_system.sh
./bin/.travis/prepare_testsystem.sh
./bin/.travis/prepare_ezpublish.sh

# Replace kernel with the one from pull-request/current checkout
rm -rf vendor/ezsystems/ezpublish-kernel
mv "$BRANCH_BUILD_DIR" vendor/ezsystems/ezpublish-kernel
23 changes: 23 additions & 0 deletions bin/.travis/prepare_unittest.sh
@@ -0,0 +1,23 @@
#!/bin/sh

# File for setting up system for unit/integration testing

# Disable xdebug to speed things up as we don't currently generate coverge on travis
if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] ; then phpenv config-rm xdebug.ini ; fi

# Setup DB
if [ "$DB" = "mysql" ] ; then mysql -e "CREATE DATABASE IF NOT EXISTS $DB_NAME;" -uroot ; fi
if [ "$DB" = "postgresql" ] ; then psql -c "CREATE DATABASE $DB_NAME;" -U postgres ; psql -c "CREATE EXTENSION pgcrypto;" -U postgres $DB_NAME ; fi

# Setup github key to avoid api rate limit
./bin/.travis/install_composer_github_key.sh

# Switch to another Symfony version if asked for
if [ "$SYMFONY_VERSION" != "" ] ; then composer require --no-update symfony/symfony=$SYMFONY_VERSION ; fi;

# Install packages using composer
composer install --prefer-dist

# Setup Solr / Elastic search if asked for
if [ "$TEST_CONFIG" = "phpunit-integration-legacy-elasticsearch.xml" ] ; then ./bin/.travis/init_elasticsearch.sh ; fi
if [ "$TEST_CONFIG" = "phpunit-integration-legacy-solr.xml" ] ; then curl -L https://raw.github.com/andrerom/travis-solr/410/travis-solr.sh | SOLR_CONFS=eZ/Publish/Core/Search/Solr/Content/schema.xml bash ; fi

0 comments on commit 46e040a

Please sign in to comment.