Codeception / Verify

BDD Assertions for PHPUnit and Codeception
MIT License
146 stars 25 forks source link

expect callableNotToThrow does not modify assertion count #56

Open ericb opened 1 year ago

ericb commented 1 year ago

When testing that an exception is not thrown, the assertion count is not raised. This is true for both variants on the latest 2.2 release:

verify($callable)->callableDoesNotThrow(\Exception::class);
expect($callable)->callableNotToThrow(\Exception::class);

Here is a sample test:

public function testCallableDoesNotThrow()
{
    $testFunction = function() {};
    expect($testFunction)->callableNotToThrow(\Exception::class);
}
Naktibalda commented 1 year ago

It happens because assertDoesNotThrow does not call any methods of \PhpUnit\Framework\Assert class.