Improving the output of PHPUnit
Let's have a little fun! Yitzchok Willroth, better know as Coderabbi, created a new package that can improve the output of PHPUnit.
Here's what the output of a testrun looks like with his package installed.
Posts tagged with phpunit
Let's have a little fun! Yitzchok Willroth, better know as Coderabbi, created a new package that can improve the output of PHPUnit.
Here's what the output of a testrun looks like with his package installed.
My colleague Sebastian recently released a new package called phpunit-snapshot-assertions. In a new post on his blog he tells all about it.
The gist of snapshot testing is asserting that a set of data hasn’t changed compared to a previous version, which is a snapshot of the data, to prevent regressions. The difference between a classic assertEquals and an assertMatchesSnapshot is that you don't write the expectation yourself when snapshot testing. When a snapshot assertion happens for the first time, it creates a snapshot file with the actual output, and marks the test as incomplete. Every subsequent run will compare the output with the existing snapshot file to check for regressions.
https://medium.com/@sebdedeyne/a-package-for-snapshot-testing-in-phpunit-2e4558c07fe3
Join thousands of developers
Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.
No spam. Unsubscribe anytime. You can also follow me on X.
In an article on the Hackster.io site explains in detail how he made a nice visualization of unit test results. Pretty cool what you can do with a raspberry pi, some LEDS and a couple of scripts.
I wanted to create a desktop gadget to visualize the progress of unit tests run via PHPUnit.I've named this project PHPUnicorn (by combining "PHPUnit" with "Unicorn pHAT").
https://www.hackster.io/colinodell/phpunicorn-visualizing-phpunit-tests-896208
On the JetBrains blog Gary Hockin explains how to easily run a single PHPUnit test.
To run all the tests in a single file, right-click the test in the Project Pane (the left-hand navigation pane), and select Run. To run all the tests in a single class, right-click the class name in the editor, and select Run
. To run the tests in a single method, right-click the method name, and select Run
.
https://blog.jetbrains.com/phpstorm/2017/01/working-with-phpunit-and-phpstorm/
Joe Ferguson shares a tip on how to make a version of PHPUnit's assertArraySubset where the order of the array does not matter.
The problem with this test is that `assertArraySubset()` will fail if the items in the array are out of order. And since we don’t have an `ORDER BY` on our query in our data source we cannot guarantee the order of the returned data.
Active support for PHP 5.4 ended on September 14, 2014 and active support for PHP 5.5 will end on June 20, 2015. The active support for PHP 5.3 already ended on July 11, 2013. By the time PHPUnit 4.8 will be released, the only actively supported version of PHP will be PHP 5.6.https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.7.0#phpunit-50The next version after PHPUnit 4.8 will not support PHP 5.3, PHP 5.4, and PHP 5.5 anymore. As PHPUnit follows Semantic Versioning the major version number must be incremented when the minimum required version of PHP is increased.
Nice!