While working with Symfony2 I’ve ended up defining a few aliases that might be of use for you. They make it a bit faster to do the things you do all the time, i.e. test and clear caches.
Here they are:
PROJECT_DIR=`pwd`
alias cc="$PROJECT_DIR/app/console cache:clear"
alias ccp="$PROJECT_DIR/app/console cache:clear --env=prod"
alias cca="cc --env=prod ; cc --env=test"
alias con="$PROJECT_DIR/app/console"
alias routes="$PROJECT_DIR/app/console router:debug"
function test {
if [ $# -gt 0 ]
then
echo "Filtering on: $1"
phpunit -c $PROJECT_DIR/app/phpunit.xml --filter $1
else
phpunit -c $PROJECT_DIR/app/phpunit.xml --verbose
fi
}Just a quick rundown:
- con is an alias to the app/console object.
- cc clears the cache
- cca clears all the caches
- routes lis an alias to the console router:debug command.
test is the command I use the most
It’s implemented as a function and the usage is as follows:
Run all tests
% test
Run the tests that hit by a filter
% test MyController::testIndex
Just remember that the aliases override the test function in bash so don’t reuse the same shell!