From added2129f7c91812442cc6ebfc01c72b9f68605 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 25 Oct 2016 11:56:30 +1300 Subject: [PATCH] NEW: Simplified travis run Travis no longer relies on travis-support or special project structures. Instead, behat and silverstripe-serve are provided as dev dependencies and used within a normal composer install structure. tests/fixtures/Page.php should be copied into the project root before a test run. .travis.yml does this. --- .gitignore | 7 +++++++ .travis.yml | 26 +++++++++++++++----------- composer.json | 14 +++++++++----- phpunit.xml.dist | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 16 deletions(-) create mode 100644 phpunit.xml.dist diff --git a/.gitignore b/.gitignore index c1249f0b..64178ef8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,12 @@ .sass-cache .DS_Store node_modules +framework +siteconfig +reports +testsession +silverstripe-cache +vendor /**/*.js.map /**/*.css.map + diff --git a/.travis.yml b/.travis.yml index 9865b278..9b516338 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ matrix: - php: 5.6 env: DB=MYSQL PDO=1 PHPUNIT_TEST=1 - php: 5.6 - env: DB=MYSQL BEHAT_TEST=1 PHPUNIT_TEST=1 + env: DB=MYSQL BEHAT_TEST=1 - php: 5.6 env: NPM_TEST=1 - php: 7.0 @@ -40,18 +40,22 @@ before_script: - composer self-update || true - phpenv rehash - phpenv config-rm xdebug.ini - - git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support - - "if [ \"$BEHAT_TEST\" = \"\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss; fi" - - "if [ \"$BEHAT_TEST\" = \"1\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require 'silverstripe/behat-extension:~2.0-dev'; fi" - - cd ~/builds/ss - - php ~/travis-support/travis_setup_selenium.php --if-env BEHAT_TEST - - php ~/travis-support/travis_setup_php54_webserver.php --if-env BEHAT_TEST - - "if [ \"$NPM_TEST\" = \"1\" ]; then (cd cms && nvm install $TRAVIS_NODE_VERSION && npm install --silent); fi" + - composer install --prefer-dist + - "if [ \"$DB\" = \"PGSQL\" ]; then composer require silverstripe/postgresql:2.0.x-dev --prefer-dist; fi" + - "if [ \"$DB\" = \"SQLITE\" ]; then composer require silverstripe/sqlite3:2.0.x-dev --prefer-dist; fi" + - "php ./tests/bootstrap/mysite.php" + - "export DISPLAY=\":99\"" + - "export XVFBARGS=\":99 -ac -screen 0 1024x768x16\"" + - "export COMPOSER_ROOT_VERSION=4.0.x-dev" + - "if [ \"$NPM_TEST\" = \"1\" ]; then (nvm install $TRAVIS_NODE_VERSION && npm install --silent); fi" + - "if [ \"$BEHAT_TEST\" = \"1\" ]; then sh -e /etc/init.d/xvfb start; sleep 3; fi" + - "if [ \"$BEHAT_TEST\" = \"1\" ]; then (vendor/bin/selenium-server-standalone > selenium.log 2>&1 &); fi" + - "if [ \"$BEHAT_TEST\" = \"1\" ]; then (vendor/bin/serve --bootstrap-file tests/behat/serve-bootstrap.php &> serve.log &); fi" script: - - "if [ \"PHPUNIT_TEST\" = \"1\" ]; then vendor/bin/phpunit cms/tests; fi" - - "if [ \"$BEHAT_TEST\" = \"1\" ]; then vendor/bin/behat @cms; fi" - - "if [ \"$NPM_TEST\" = \"1\" ]; then (cd cms && nvm use 4 && npm run lint); fi" + - "if [ \"$PHPUNIT_TEST\" = \"1\" ]; then vendor/bin/phpunit tests flush=1; fi" + - "if [ \"$BEHAT_TEST\" = \"1\" ]; then vendor/bin/behat .; fi" + - "if [ \"$NPM_TEST\" = \"1\" ]; then (nvm use 4 && npm run lint); fi" after_failure: - php ~/travis-support/travis_upload_artifacts.php --if-env BEHAT_TEST,ARTIFACTS_BUCKET,ARTIFACTS_KEY,ARTIFACTS_SECRET --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/ diff --git a/composer.json b/composer.json index 03cd29a2..03806e2f 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,16 @@ "require": { "php": ">=5.5.0", "composer/installers": "*", - "silverstripe/framework": "^4.0", - "silverstripe/reports": "^4.0", - "silverstripe/siteconfig": "^4.0" + "silverstripe/framework": "^4.0@dev", + "silverstripe/reports": "^4.0@dev", + "silverstripe/siteconfig": "^4.0@dev" }, "require-dev": { - "phpunit/PHPUnit": "~4.8" + "phpunit/PHPUnit": "~4.8", + "silverstripe/behat-extension": "^2.1.0", + "silverstripe/serve": "dev-master", + "silverstripe/testsession": "^2.0.0-alpha3", + "se/selenium-server-standalone": "2.41.0" }, "extra": { "branch-alias": { @@ -36,5 +40,5 @@ }, "classmap": ["tests/behat/"] }, - "minimum-stability": "dev" + "minimum-stability": "stable" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..4bfdbc59 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,44 @@ + + + + + tests + + + + + + + + + sanitychecks + + + + + + . + + tests/ + + + + +