Verify icon indicating copy to clipboard operation
Verify copied to clipboard

expect callableNotToThrow does not modify assertion count

Open ericb opened this issue 3 years ago • 1 comments

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);
}

ericb avatar Dec 22 '22 15:12 ericb

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

Naktibalda avatar Dec 25 '22 17:12 Naktibalda