phpunitHow to use PHPUnit assertequals?
PHPUnit assertequals is a method used to compare two values and check if they are equal.
Example
$this->assertEquals(2, 1+1);
Output example
OK
Code explanation
assertEquals
: the method used to compare two values2
: the expected value1+1
: the actual value
Helpful links
More of Phpunit
- How to show warnings in PHPUnit?
- How to stop PHPUnit on failure?
- How to skip a PHPUnit test?
- How to mock a query builder with PHPUnit?
- How to install PHPUnit with a PHAR file?
- How to generate a coverage report with PHPUnit?
- How to test private methods in PHPUnit?
- How to order tests with PHPUnit?
- How to mock a property in PHPUnit?
- How to mock a method with PHPUnit?
See more codes...