Tests... without assertions? #tdd #php

preview_player
Показать описание
Sometimes it can be useful to write tests which don't explicitly make assertions.

This is especially when you want confidence a particular code path doesn't throw an error - but you're not interested in return values or other types of side effects.

This is when the `expectNotToPerformAssertions` method in PHPUnit can be useful.

It's important to use this method judiciously, though.

Sure, it can be useful in cases where the primary goal of the test case is ensuring a certain code path doesn't produce an error (or unexpected outcomes) rather than explicitly checking for specific expected results - but there are plenty of trade offs to consider.

Subscribe if you would like to be notified of the video discussing these trade offs.

---

#php #tdd #laravel #phpunit
Рекомендации по теме
welcome to shbcf.ru