Use PHPStan to analyze your tests, to make them more effective, and reduce bugs
Jun 10, 2024
Learn how to use mocks and stubs in PHPUnit to make your tests faster and more focused.
May 30, 2024
Learn how to use data providers in PHPUnit, to test a lot of scenarios and reduce code duplication
May 22, 2024
Learn how to write your first tests in PHPUnit, using assertions. Use methods like setUp and tearDown, to reduce code duplication
May 17, 2024
In this blog series we’ll go from writing our first unit test to being a PHPUnit master. This first post will go over the basics, and introduce you to PHPUnit
May 3, 2024
Last week i gave 10 phpunit tips. This week we’ll take a look at testing exceptions, which wasn’t covered in that post. Lets start with some example code that we will be testing. We have the Email and EmailValidator classes. Email is a value object that makes sure it is a valid email. We use the EmailValidator to make sure that the emails are only from our company.
Apr 9, 2021
PHPUnit is the defacto testing framework for PHP. In this post i want to share with you my top 10 tips for PHPUnit. I’m using PHPUnit 9.5, but most of these apply to older versions as well. So, lets get this party started.
Apr 2, 2021
Once you have set up your first unit tests, and you have a good configuration, its time to add a lot of tests. Lets take a look at using data providers, as a way to test with a lot of data.
Feb 26, 2021
If you just got started with PHPUnit, its configuration file may be a bit daunting. Today we’re gonna walk through (what i consider) the ideal config file. If you’re just here to copy paste the config, then you can find it at thebottom 👇.
Feb 19, 2021
Our code base has a lot of code that looks like this: <?php try { $this->doScaryThing(); } catch(Exception $e) { trigger_error("Downgraded: " . get_class($e) . ":" . $e->getMessage(), E_USER_WARNING); }
Nov 21, 2019