When you're working on a project with a strong test suite you'll want to make sure that everything you push to the repository doesn't break any of the tests that you have in your project. This means that before you preform a git push you'll need to make sure you run phpunit and that all your tests have passed. In this tutorial we're going to add a rule into your git repository to make sure that we can't push any new code into the repository without the tests passing, to do this we're going to use git hooks.

These are the git hooks that we have available to use applypatch-msg commit-msg post-update pre-applypatch pre-commit pre-commit prepare-commit-msg pre-push pre-rebase pre-receive update

To run our phpunit tests we're going to use the pre-push hook that runs before we push to the repository.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners