Skip to content

Instantly share code, notes, and snippets.

@kamilkisiela
Last active March 6, 2016 19:21
Show Gist options
  • Save kamilkisiela/0e8535db7c8c2cca252f to your computer and use it in GitHub Desktop.
Save kamilkisiela/0e8535db7c8c2cca252f to your computer and use it in GitHub Desktop.
Codeship - Symfony2 with mysql - phpunit
# Set php version through phpenv
phpenv local 5.5
# Modify memory limit and realpath cache size
echo "realpath_cache_size = 4096k" >> $HOME/.phpenv/versions/5.5/etc/php.ini
echo "memory_limit = 512M" >> $HOME/.phpenv/versions/5.5/etc/php.ini
# Disable xdebug
echo "xdebug.remote_autostart=0" >> $HOME/.phpenv/versions/5.5/etc/php.ini
echo "xdebug.remote_enable=0" >> $HOME/.phpenv/versions/5.5/etc/php.ini
echo "xdebug.profiler_enable=0" >> $HOME/.phpenv/versions/5.5/etc/php.ini
# Set environment variables
export SYMFONY_ENV=test
export SYMFONY__TEST_DATABASE_NAME=test
export SYMFONY__TEST_DATABASE_USER=$MYSQL_USER
export SYMFONY__TEST_DATABASE_PASSWORD=$MYSQL_PASSWORD
# Copy the parameters.yml.dist
cp app/config/parameters.yml.dist app/config/parameters.yml
# Install dependencies
composer install --prefer-source --no-interaction
# Drop and create database
php ./app/console --env=test doctrine:database:drop --force
php ./app/console --env=test doctrine:database:create
# Update database schema
php ./app/console --env=test doctrine:schema:update --force
# Clear cache
php ./app/console --env=test cache:clear
# If phpunit is composer's dependency
bin/phpunit -c app/
# Else
# phpunit -c app/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment