REBELinBLUE
5/14/2016 - 10:45 PM

phpunit.bash

    # TODO: Extract output from tap file to include number of tests in message
    phpunit() {
        php -dzend_extension=$(brew --prefix php70-xdebug)/xdebug.so ./deployer/vendor/bin/phpunit $@
        RESULT=$?

        if [[ $RESULT = 0 ]]; then
            TITLE="Success"
            MESSAGE="Tests ran succesfully"
            IMAGE="$HOME/.dotfiles/files/icons/Success.icns"
            SOUND="Glass"
        elif [[ $RESULT = 1 ]]; then
            TITLE="Failed"
            MESSAGE="Tests are broken"
            IMAGE="$HOME/.dotfiles/files/icons/Failed.icns"
            SOUND="Basso"
        else
            return $RESULT
        fi

        $(brew --prefix terminal-notifier)/bin/terminal-notifier -activate "com.googlecode.iTerm2" \
                                                                 -contentImage "$IMAGE" \
                                                                 -title "PHPUnit"\
                                                                 -subtitle "$TITLE" \
                                                                 -sound "$SOUND" \
                                                                 -message "$MESSAGE"
    }