diff --git a/.gitattributes b/.gitattributes index 475f5f2..89eb187 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,4 @@ /.gitignore export-ignore /.travis.yml export-ignore /.scrutinizer.yml export-ignore +/codecov.yml export-ignore diff --git a/.travis.yml b/.travis.yml index 773dc85..673e366 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,36 +1,54 @@ -# See https://github.com/silverstripe/silverstripe-travis-support for setup details - language: php -sudo: false - -sudo: false - -php: - - 5.5 +addons: + firefox: "31.0" env: global: - - CORE_RELEASE=4 - matrix: - - DB=MYSQL - - DB=PGSQL + - COMPOSER_ROOT_VERSION="4.0.x-dev" + - DISPLAY=":99" + - XVFBARGS=":99 -ac -screen 0 1024x768x16" matrix: include: - - php: 5.5 + - php: 5.6 + env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1 + - php: 7.0 + env: DB=PGSQL PHPUNIT_TEST=1 + - php: 7.1 + env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1 + - php: 7.0 env: DB=MYSQL BEHAT_TEST=1 before_script: - - composer self-update || true - - phpenv rehash - - git clone git://github.com/silverstripe/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; 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 + - phpenv rehash + - phpenv config-rm xdebug.ini + - echo 'memory_limit = 2G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + + - composer install --prefer-dist + - composer require silverstripe/recipe-cms 1.0.x-dev --no-update --prefer-dist + - if [[ $DB == PGSQL ]]; then composer require --prefer-dist --no-update silverstripe/postgresql:2.0.x-dev; fi + - composer update + + # Bootstrap cms / mysite folder + - php ./cms/tests/bootstrap/mysite.php + + # Behat bootstrapping + - if [[ $BEHAT_TEST ]]; then echo "" >> .env && echo "SS_BASE_URL=http://localhost:8080/" >> .env; fi + - if [[ $BEHAT_TEST ]]; then mkdir artifacts; fi + - if [[ $BEHAT_TEST ]]; then sh -e /etc/init.d/xvfb start; sleep 3; fi + - if [[ $BEHAT_TEST ]]; then (vendor/bin/selenium-server-standalone > artifacts/selenium.log 2>&1 &); fi + - if [[ $BEHAT_TEST ]]; then (vendor/bin/serve --bootstrap-file cms/tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi + script: - - "if [ \"$BEHAT_TEST\" = \"\" ]; then vendor/bin/phpunit subsites/tests; fi" - - "if [ \"$BEHAT_TEST\" = \"1\" ]; then vendor/bin/behat @subsites; fi" + - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/php/ flush=1; fi + - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi + - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=framework/phpcs.xml.dist code/ tests/ ; fi + - if [[ $BEHAT_TEST ]]; then vendor/bin/behat @subsites; fi + +after_success: + - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi + +after_failure: + - if [[ $BEHAT_TEST ]]; then php ./framework/tests/behat/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/ --artifacts-path ./artifacts/; fi diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..69cb760 --- /dev/null +++ b/codecov.yml @@ -0,0 +1 @@ +comment: false diff --git a/composer.json b/composer.json index 625a5fa..308385e 100644 --- a/composer.json +++ b/composer.json @@ -11,12 +11,19 @@ } ], "require": { - "silverstripe/framework": "~4.0", - "silverstripe/cms": "~4.0", - "silverstripe/asset-admin": "~1.0.0" + "silverstripe/framework": "^4", + "silverstripe/cms": "^4", + "silverstripe/admin": "^1", + "silverstripe/asset-admin": "^1", + "silverstripe/errorpage": "^1", + "silverstripe/versioned": "^1" }, "require-dev": { - "phpunit/PHPUnit": "~4.8@stable" + "phpunit/phpunit": "^5.7", + "squizlabs/php_codesniffer": "^3.0", + "silverstripe/behat-extension": "^3", + "silverstripe/serve": "dev-master", + "se/selenium-server-standalone": "2.41.0" }, "autoload": { "psr-4": { @@ -28,5 +35,7 @@ "branch-alias": { "dev-master": "2.0.x-dev" } - } + }, + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b4a30c4..f144246 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,14 @@ + + tests/php + - - tests/php - - + + + code/ + + tests/ + + + diff --git a/tests/SubsiteXHRControllerTest.php b/tests/SubsiteXHRControllerTest.php index c38a150..f4cb361 100644 --- a/tests/SubsiteXHRControllerTest.php +++ b/tests/SubsiteXHRControllerTest.php @@ -1,11 +1,7 @@