Skip to content

Instantly share code, notes, and snippets.

@lennartvdd
Last active September 8, 2016 22:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lennartvdd/6f327bcc20d6c9ee5dd6 to your computer and use it in GitHub Desktop.
Save lennartvdd/6f327bcc20d6c9ee5dd6 to your computer and use it in GitHub Desktop.
CodeShip - Yii 2.x (Advanced Template) test setup script
# Set php version through phpenv. 5.3, 5.4 and 5.5 available
phpenv local 5.4
# == install pecl extensions
yes yes | pecl install imagick
# == prepare composer
composer config -g github-oauth.github.com "$GITHUB_ACCESS_TOKEN" #make sure this env var is configured in your project settings. otherwise remove this line.
# update phpunit
composer global remove "phpunit/phpunit" --update-with-dependencies
composer global require "phpunit/phpunit=4.*"
# == install composer global dependencies
composer global require "fxp/composer-asset-plugin:~1.1.4"
composer global require "codeception/codeception=2.1.*" "codeception/specify=*" "codeception/verify=*"
# == install project ==
composer install --prefer-source --no-interaction
# == Configure Yii 2 Environment (yii2-app-advanced template specific)
chmod +x ./init
./init --env=Test --overwrite=y # set this to whatever environment you use for CI.
# == perform migrations
./yii migrate --interactive=0
# == prepare for functional/acceptence tests
nohup bash -c "php -S 127.0.0.1:8080 2>&1 &" && sleep 1; cat nohup.out
nohup bash -c "phantomjs --webdriver=4444 2>&1 &" && sleep 1; cat nohup.out
cd tests/
# == codeception build
codecept build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment