Feature spotlight: PHP Unit

Feature spotlight: PHP Unit

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.

Image loading...PHPUnit action details

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.

  1. Create a new project, choose your Git provider, and select your PHP repository.
  2. Add a new pipeline and switch the trigger mode to On every push
  3. Add PHPUnit action. You can install any missing modules in the Packages & Setup tab
  4. 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 install on 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:

Image loading...PHPUnit workflow

If your tests require a database to run, eg. MySQL, you can easily activate them in the Services tab:

Image loading...Attaching database

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:

Image loading...Slack conditional notification

Summary

If you'd like to learn more about using Buddy in PHP development, check out our guides on automating PHP dependencies and Wordpress themes with Buddy.

Happy coding!

Jarek Dylewski

Jarek Dylewski

Customer Support

A journalist and an SEO specialist trying to find himself in the unforgiving world of coders. Gamer, a non-fiction literature fan and obsessive carnivore. Jarek uses his talents to convert the programming lingo into a cohesive and approachable narration.

Feb 23rd 2017
Share