Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Testing Frenzy – Can We BDD Test the Units?
Jan 30, 2017 @ 12:50:10

On the SitePoint PHP blog editor Bruno Skvorc has written up a tutorial about using the Peridot tool to do BDD style testing but on the units of code rather than the behavior of your integrated application (your business logic).

We’ve done our share of testing posts here at SitePoint, with more coming soon, but I wanted to show you a relatively new testing tool I found that caught my attention because of how unconventional it seemed.

Peridot is a BDD testing framework (so behavior driven testing) but for your units of code – not your business logic. Wait, what? Yes.

He gives an example of the test structure and how a similar kind of test would reduce down to assertions evaluating your units of code. He also includes an example of Peridot's human-friendly output for both passing and failing tests. He goes on to talk about the concurrency the tool allows, the feature to focus on/skip certain tests, use events and plugins, and output a code coverage report. Several more features are also discussed including custom scopes and the ability to define custom DSL definitions you might find easier to work with in your testing.

tagged: bdd test unittest peridot tool package tutorial introduction

Link: https://www.sitepoint.com/testing-frenzy-can-we-bdd-test-the-units/