Category: phpunit

Re-Introducing PHPUnit – Getting Started with TDD in PHP

There are a lot of PHPUnit posts on our site already (just check the tag), but it’s been a while since we’ve actually introduced people to it, and the tool has evolved significantly since then. This article aims to re-introduce the tool in a modern way, to a modern audience, in a modern PHP environment R...

8 Must Have PHP Quality Assurance Tools

For shipping quality code, we must have testing in mind while coding (if not doing TDD). However, with the wide range of PHP testing tools out there, it’s hard to make a choice! Exploring PHP is a fun adventure (premium course on that here!) but it’s hard to assemble a toolbelt that’s not too heavy to...

Family CRMs, Guzzle Wrappers and PHP Machine Learning? Sourcehunt!

If you’re new to Sourcehunt, it’s our monthly post for promoting open source projects that seem interesting or promising and could use help in terms of Github stars or pull requests. It’s our way of giving back – promoting projects that we use (or could use) so that they gain enough exposure to ...

Upgrading Sylius the TDD Way: Exploring Behat

Last time, we developed some new features on top of Sylius’ core to indicate which products and their variants are low on stock and need replenishing. Now, we move on to seeing our changes in the UI, which means we will need to do a bit of StoryBDD testing. When browsing the list of products, we want to see a new...

Upgrading Sylius the TDD Way: Exploring PhpSpec

The post on developing and testing new Sylius features was an introduction to the three types of tests that are used in Sylius – PHPUnit, Phpspec and Behat. In this part, we’ll extend some core classes to indicate color-coded inventory status. First, we’ll deal with the back end part. In a followup po...

Sylius and Cutting Your Teeth on TDD

Sylius is an e-commerce application / framework based on Symfony. It boasts 100% code coverage, which is impressive for a PHP application of that size. In this article, we are going to walk through the different kinds of tests available and try out some Test and Behavior Driven Development (TDD/BDD). See the Sylius in...

Testing PHP Code with Atoum – an Alternative to PHPUnit

If you’ve been around PHP for more than a little while, you’ve no doubt started to test your code. And if you ask anyone in the PHP space what to use for writing unit tests, likely the first answer that they’ll give you is PHPUnit. It’s the de facto standard in the PHP community, and with good reason. But it’...

Hassle-Free Filesystem Operations during Testing? Yes Please!

When working with the filesystem in our tests suites, a big concern is cleaning up the temporary files after each test runs. However, if for any reason the test’s execution is interrupted before the cleanup phase, further tests might fail, as the environment has not been cleaned up.In this post, we will use a l...

Testing Your Tests? Who Watches the Watchmen?

Regardless of whether you’re working for a big corporation, a startup, or just for yourself, unit testing is not only helpful, but often indispensable. We use unit tests to test our code, but what happens if our tests are wrong or incomplete? What can we use to test our tests? Who watches the watchmen? Enter [...

An Overview of PHPUnit 5 – What’s New? What’s Coming?

It was January 2016 when the PHPUnit development team announced the release of PHPUnit 5.0.While several minor version have already been released since, PHPUnit’s major version 5 has introduced several new functionalities and deprecated a few others. In this article, we’ll take a look at the most notable...