diff --git a/bin/phpunit-or-pest b/bin/phpunit-or-pest new file mode 100755 index 0000000..781b712 --- /dev/null +++ b/bin/phpunit-or-pest @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if [[ -f "vendor/bin/pest" ]]; then + echo "pest" + exit 0 +fi + +echo "phpunit" diff --git a/tag-zsh/zsh/configs/aliases.zsh b/tag-zsh/zsh/configs/aliases.zsh index 678d0a5..a840741 100644 --- a/tag-zsh/zsh/configs/aliases.zsh +++ b/tag-zsh/zsh/configs/aliases.zsh @@ -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 diff --git a/tag-zsh/zsh/configs/functions.zsh b/tag-zsh/zsh/configs/functions.zsh index 0a963f4..1f81ffe 100644 --- a/tag-zsh/zsh/configs/functions.zsh +++ b/tag-zsh/zsh/configs/functions.zsh @@ -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 $* +}