assertGreaterThan()
assertGreaterThan(mixed $expected, mixed $actual[, string $message = ''])
Reports an error identified by $message
if the value of $actual
is not greater than the value of $expected
.
assertAttributeGreaterThan()
is a convenience wrapper that uses a public
, protected
, or private
attribute of a class or object as the actual value.
Example A.26: Usage of assertGreaterThan()
<?php use PHPUnit\Framework\TestCase; class GreaterThanTest extends TestCase { public function testFailure() { $this->assertGreaterThan(2, 1); } } ?>
phpunit GreaterThanTest PHPUnit 5.6.0 by Sebastian Bergmann and contributors. F Time: 0 seconds, Memory: 5.00Mb There was 1 failure: 1) GreaterThanTest::testFailure Failed asserting that 1 is greater than 2. /home/sb/GreaterThanTest.php:6 FAILURES! Tests: 1, Assertions: 1, Failures: 1.
Please login to continue.