diff --git a/.travis.yml b/.travis.yml index 29185bc..3d4023b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,16 +2,15 @@ language: php dist: trusty -sudo: required - -group: deprecated-2017Q4 +before_install: + - sudo apt-get update + - sudo apt-get install chromium-chromedriver cache: directories: - $HOME/.composer/cache/files addons: - firefox: "31.0" apt: packages: - tidy @@ -22,6 +21,8 @@ env: - COMPOSER_ROOT_VERSION="4.1.x-dev" - DISPLAY=":99" - XVFBARGS=":99 -ac -screen 0 1024x768x16" + - SS_BASE_URL="http://localhost:8080/" + - SS_ENVIRONMENT_TYPE="dev" matrix: fast_finish: true @@ -59,8 +60,16 @@ matrix: env: - BEHAT_TEST="@asset-admin" - DB=MYSQL + - php: 5.6 + env: + - HEALTH_TEST=1 + - DB=MYSQL + - PDO=1 before_script: +# Extra $PATH + - export PATH=/usr/lib/chromium-browser/:$PATH + # Init PHP - phpenv rehash - phpenv config-rm xdebug.ini || true @@ -69,23 +78,26 @@ before_script: # Install composer dependencies - composer validate - if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.0.x-dev; fi - - if [[ $BEHAT_TEST ]]; then composer require --no-update silverstripe/behat-extension:^3 silverstripe/serve:^2 se/selenium-server-standalone:2.41.0; fi; - - composer install --prefer-source --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile + - if [[ $BEHAT_TEST ]]; then composer require --no-update silverstripe/recipe-testing:^1; fi; + - if [[ $HEALTH_TEST ]]; then composer require --no-update silverstripe/serve:^2; fi; + - if ! [[ $HEALTH_TEST ]]; then composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile; fi; + - if [[ $HEALTH_TEST ]]; then composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile --no-dev; fi; # Start behat services - - if [[ $BEHAT_TEST ]]; then echo 'SS_BASE_URL=http://localhost:8080/' >> .env; fi - - if [[ $BEHAT_TEST ]]; then mkdir artifacts; fi - - if [[ $BEHAT_TEST ]]; then cp composer.lock artifacts/; fi + - if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then mkdir artifacts; fi + - if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then cp composer.lock 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 vendor/silverstripe/cms/tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi + - if [[ $BEHAT_TEST ]]; then (chromedriver > artifacts/chromedriver.log 2>&1 &); fi + - if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then (vendor/bin/serve --bootstrap-file vendor/silverstripe/cms/tests/behat/serve-bootstrap.php &> artifacts/serve.log &); sleep 3; fi script: - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit --testsuite $PHPUNIT_TEST; fi - if [[ $BEHAT_TEST ]]; then vendor/bin/behat $BEHAT_TEST; fi + - if [[ $HEALTH_TEST ]]; then curl -vfL http://localhost:8080/dev/build?flush; fi + - if [[ $HEALTH_TEST ]]; then curl -vfL http://localhost:8080/admin; fi after_failure: - - if [[ $BEHAT_TEST ]]; then php ./vendor/silverstripe/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 + - if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then php ./vendor/silverstripe/framework/tests/behat/travis-upload-artifacts.php --if-env 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 notifications: slack: silverstripeltd:Cls1xnypKBLFhv0YIRtNLzlQ diff --git a/behat.yml b/behat.yml index feb4362..f092b55 100644 --- a/behat.yml +++ b/behat.yml @@ -1,20 +1,20 @@ -# Note: Currently firefox 31-ESR is recommended +# Note: Currently chrome latest is recommended # Behat test setup requires an `.env` with `SS_BASE_URL` defined, as well # as each of the following commands to initiate a test run: # ========================================================================= # -# composer require silverstripe/behat-extension:^3 silverstripe/serve:dev-master se/selenium-server-standalone:2.41.0 -# vendor/bin/selenium-server-standalone -Dwebdriver.firefox.bin="/Applications/Firefox31.app/Contents/MacOS/firefox-bin" -# vendor/bin/serve --bootstrap-file vendor/silverstripe/cms/tests/behat/serve-bootstrap.php -# vendor/bin/behat @ +# composer require silverstripe/recipe-testing ^1 +# vendor/bin/behat-ss @ # ========================================================================= # default: suites: [] extensions: SilverStripe\BehatExtension\MinkExtension: - default_session: selenium2 - javascript_session: selenium2 - selenium2: - browser: firefox + default_session: facebook_web_driver + javascript_session: facebook_web_driver + facebook_web_driver: + browser: chrome + wd_host: "http://127.0.0.1:9515" #chromedriver port + browser_name: chrome SilverStripe\BehatExtension\Extension: bootstrap_file: vendor/silverstripe/cms/tests/behat/serve-bootstrap.php screenshot_path: %paths.base%/artifacts/screenshots diff --git a/public/assets/.htaccess b/public/assets/.htaccess index eebdb1d..8c3eefb 100644 --- a/public/assets/.htaccess +++ b/public/assets/.htaccess @@ -4,6 +4,15 @@ # See AssetAdapter::renderTemplate() for reference. # +# We disable PHP via several methods +# Replace the handler with the default plaintext handler +AddHandler default-handler php phtml php3 php4 php5 inc + + + # Turn the PHP engine off + php_flag engine off + + SetEnv HTTP_MOD_REWRITE On @@ -11,16 +20,12 @@ RewriteEngine On - # Disable PHP handler - RewriteCond %{REQUEST_URI} .(?i:php|phtml|php3|php4|php5|inc)$ - RewriteRule .* - [F] - # Allow error pages RewriteCond %{REQUEST_FILENAME} -f RewriteRule error[^\\/]*\.html$ - [L] # Block invalid file extensions - RewriteCond %{REQUEST_URI} !\.(?i:ace|arc|arj|asf|au|avi|bmp|bz2|cab|cda|css|csv|dmg|doc|docx|dotx|dotm|flv|gif|gpx|gz|hqx|ico|jar|jpeg|jpg|js|kml|m4a|m4v|mid|midi|mkv|mov|mp3|mp4|mpa|mpeg|mpg|ogg|ogv|pages|pcx|pdf|png|pps|ppt|pptx|potx|potm|ra|ram|rm|rtf|sit|sitx|tar|tgz|tif|tiff|txt|wav|webm|wma|wmv|xls|xlsx|xltx|xltm|zip|zipx)$ + RewriteCond %{REQUEST_URI} !^[^.]*\.(?i:css|js|ace|arc|arj|asf|au|avi|bmp|bz2|cab|cda|csv|dmg|doc|docx|dotx|flv|gif|gpx|gz|hqx|ico|jpeg|jpg|kml|m4a|m4v|mid|midi|mkv|mov|mp3|mp4|mpa|mpeg|mpg|ogg|ogv|pages|pcx|pdf|png|pps|ppt|pptx|potx|ra|ram|rm|rtf|sit|sitx|tar|tgz|tif|tiff|txt|wav|webm|wma|wmv|xls|xlsx|xltx|zip|zipx)$ RewriteRule .* - [F] # Non existant files passed to requesthandler