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 skip a PHPUnit test?
- How to run tests in parallel with PHPUnit?
- How to use hooks in PHPUnit?
- What are PHPUnit required extensions
- How to use the PHPUnit Framework TestCase?
- How to run PHPUnit in quiet mode?
- How to show warnings in PHPUnit?
- How to load fixtures with PHPUnit?
- How to use a listener with PHPUnit?
- How to stop PHPUnit on failure?
See more codes...