Skip to content

Instantly share code, notes, and snippets.

@jakob-stoeck
Forked from havvg/git-bisect-phpunit.sh
Last active December 15, 2015 16:49
Show Gist options
  • Save jakob-stoeck/5292227 to your computer and use it in GitHub Desktop.
Save jakob-stoeck/5292227 to your computer and use it in GitHub Desktop.
docs
#!/bin/bash
# Script to use with git bisect for phpunit tests for yii apps
#
# Should lie under protected/tests
# usage:
#
# git bisect start __bad__ __good__ --
# git bisect run protected/tests/git-bisect-phpunit.sh __args__
#
# where __args__ are phpunit arguments:
#
# * <empty>: all tests
# * unit/User.php: user test
# * --filter=testLogin unit/User.php: testLogin action of the user test
FOLDER=$PWD/protected/tests
phpunit -c $FOLDER/phpunit.xml $FOLDER/$1
EXIT_CODE="$?"
if [ $EXIT_CODE -eq "255" ]; then
# Wrapping the error code to 1, so bisect marks this build as "bad" and continues.
exit 1
fi
if [ $EXIT_CODE -eq "2" ]; then
# The testsuite does not exist, so we skip bisect here.
exit 125
fi
exit $EXIT_CODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment