Skip to content

Commit 04982e3

Browse files
johannesschobelDavertMik
authored andcommitted
adding new assert methods (#5029)
1 parent facb188 commit 04982e3

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/Codeception/Module/Asserts.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,17 @@ public function assertTrue($condition, $message = '')
263263
parent::assertTrue($condition, $message);
264264
}
265265

266+
/**
267+
* Checks that the condition is NOT true (everything but true)
268+
*
269+
* @param $condition
270+
* @param string $message
271+
*/
272+
public function assertNotTrue($condition, $message = '')
273+
{
274+
parent::assertNotTrue($condition, $message);
275+
}
276+
266277
/**
267278
* Checks that condition is negative.
268279
*
@@ -274,6 +285,17 @@ public function assertFalse($condition, $message = '')
274285
parent::assertFalse($condition, $message);
275286
}
276287

288+
/**
289+
* Checks that the condition is NOT false (everything but false)
290+
*
291+
* @param $condition
292+
* @param string $message
293+
*/
294+
public function assertNotFalse($condition, $message = '')
295+
{
296+
parent::assertNotFalse($condition, $message);
297+
}
298+
277299
/**
278300
* Checks if file exists
279301
*

tests/unit/Codeception/Module/AssertsTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ public function testAsserts()
1919
$module->assertNotNull(false);
2020
$module->assertNotNull(0);
2121
$module->assertTrue(true);
22+
$module->assertNotTrue(false);
23+
$module->assertNotTrue(null);
24+
$module->assertNotTrue('foo');
2225
$module->assertFalse(false);
26+
$module->assertNotFalse(true);
27+
$module->assertNotFalse(null);
28+
$module->assertNotFalse('foo');
2329
$module->assertFileExists(__FILE__);
2430
$module->assertFileNotExists(__FILE__ . '.notExist');
2531
$module->assertInstanceOf('Exception', new Exception());

0 commit comments

Comments
 (0)