Skip to content

Instantly share code, notes, and snippets.

@paulstatezny
Last active August 29, 2015 14:11
Show Gist options
  • Save paulstatezny/f0ec8dbfc9f604a7f757 to your computer and use it in GitHub Desktop.
Save paulstatezny/f0ec8dbfc9f604a7f757 to your computer and use it in GitHub Desktop.
Fish function to run PHPUnit
function unit
# Remove logging portion of phpunit configuration
sed -i .sedbackup 's/\<\/logging\>//g' ./phpunit.xml
sed -i .sedbackup 's/\<logging\>//g' ./phpunit.xml
rm *.sedbackup
if set -q argv[1]
vendor/bin/phpunit --filter $argv[1]
else
vendor/bin/phpunit
end
git checkout phpunit.xml
end
@paulstatezny
Copy link
Author

$ unit
$ unit SyncService

Run this function in the src directory of a PHP application. The function:

  1. Removes any <logging> section of the PHPUnit configuration (will speed up execution).
  2. Runs the tests.

Optionally, you can provide a filter argument to the function and it will only run test files whose names match the filter. (Case sensitive.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment