Run phpunit or pest depending on the project

Remove the `p` and `pf` aliases that previously only worked for PHPUnit,
and re-add them as functions that run either PHPUnit or Pest PHP based
on the project dependencies.

The checking is done within the `phpunit-or-pest` script and then used
within the new `p` and `pf` functions.
This commit is contained in:
Oliver Davies 2020-07-23 09:45:48 +01:00
parent ce9a65340e
commit a85ff2e8bb
3 changed files with 16 additions and 2 deletions

8
bin/phpunit-or-pest Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
if [[ -f "vendor/bin/pest" ]]; then
echo "pest"
exit 0
fi
echo "phpunit"

View file

@ -2,8 +2,6 @@ alias c="clear"
alias l="ls -lah"
alias m=make
alias mkdir="mkdir -p"
alias p=phpunit
alias pf=phpunit --filter
alias s=symfony
alias v=vagrant

View file

@ -21,3 +21,11 @@ function db {
is_linux() { [[ "$(uname)" == 'Linux' ]] }
is_macos() { [[ "$(uname)" == "Darwin" ]] }
# Run 'phpunit' or 'pest' depending on the project.
function p () {
vendor/bin/$(phpunit-or-pest) $*;
}
function pf () {
vendor/bin/$(phpunit-or-pest) --filter $*
}