I want to pass tests which get the following: "This test did not perform any assertions"
I know I could add something like assertTrue(true)
however is it possible to add something to the config to make these tests pass cleaner?
I'm pretty sure this only happens since version PHPUnit 3.5.0 with the introduction of
--strict
The assertEquals() function is a builtin function in PHPUnit and is used to assert whether the actual obtained value is equals to expected value or not. This assertion will return true in the case if the expected value is the same as the actual value else returns false.
PHPUnit is a unit testing framework for the PHP programming language. It is an instance of the xUnit design for unit testing systems that began with SUnit and became popular with JUnit. Even a small software development project usually takes hours of hard work.
Likewise, PHPUnit mock object is a simulated object that performs the behavior of a part of the application that is required in the unit test. The developers control the mock object by defining the pre-computed results on the actions.
Use the @doesNotPerformAssertions
annotation:
/**
* @doesNotPerformAssertions
*/
public function testCodeWithoutUsingAssertions()
{
// do stuff...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With