Skip to content

Commit

Permalink
Added expectNotToPerformAssertions method
Browse files Browse the repository at this point in the history
  • Loading branch information
VladaHejda committed Dec 5, 2017
1 parent 150bb82 commit 3b20e49
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,11 @@ public function expectExceptionObject(\Exception $exception)
$this->expectExceptionCode($exception->getCode());
}

public function expectNotToPerformAssertions()
{
$this->doesNotPerformAssertions = true;
}

/**
* @param bool $flag
*/
Expand Down
13 changes: 13 additions & 0 deletions tests/Framework/TestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,19 @@ public function testWrongException()
$this->assertCount(1, $result);
}

public function testDoesNotPerformAssertions()
{
$test = new \DoNoAssertionTestCase('testNothing');
$test->expectNotToPerformAssertions();

$result = $test->run();

$this->assertTrue($result->isStrictAboutTestsThatDoNotTestAnything());

$this->assertEquals(0, $result->riskyCount());
$this->assertCount(1, $result);
}

/**
* @backupGlobals enabled
*/
Expand Down
9 changes: 9 additions & 0 deletions tests/_files/DoNoAssertionTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
use PHPUnit\Framework\TestCase;

class DoNoAssertionTestCase extends TestCase
{
public function testNothing()
{
}
}

0 comments on commit 3b20e49

Please sign in to comment.