PHPUnit is a popular programmer-oriented testing framework for PHP. You can use it to test your code before the deployment so that you know the copy on your server is free of errors.
Configuring tests and delivery with Buddy
There’s still a wide range of developers who haven’t heard or don’t know how to introduce Continuous Integration to their process. Buddy lets you set up the whole workflow in 10-15 minutes (either through GUI or YAML) and easily scale and expand once your projects grow bigger.
- Create a new project, choose your Git provider, and select your PHP repository.
- Add a new pipeline and switch the trigger mode to On every push
- Add PHPUnit action. You can install any missing modules in the Packages & Setup tab
- Add FTP/SFTP file transfer action and configure your deployment
TIP: You can also add the SSH action and use it, eg. to run
composer installon your server.
This way every time you’ll make a push to the selected branch, Buddy will automatically test and deploy the changes to the server + run the desired SSH commands:
If your tests require a database to run, eg. MySQL, you can easily activate them in the Services tab:
A good practice is to add a conditional notification in the end that will send you a message in case the tests or the deployment have failed, for example to your Slack channel: