assertFalse()

assertFalse()

assertFalse(bool $condition[, string $message = ''])

Reports an error identified by $message if $condition is true.

assertNotFalse() is the inverse of this assertion and takes the same arguments.

Example A.21: Usage of assertFalse()

<?php
use PHPUnit\Framework\TestCase;

class FalseTest extends TestCase
{
    public function testFailure()
    {
        $this->assertFalse(true);
    }
}
?>
phpunit FalseTest
PHPUnit 5.6.0 by Sebastian Bergmann and contributors.

F

Time: 0 seconds, Memory: 5.00Mb

There was 1 failure:

1) FalseTest::testFailure
Failed asserting that true is false.

/home/sb/FalseTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
doc_PHPUnit
2016-10-16 15:37:36
Comments
Leave a Comment

Please login to continue.