Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect callableNotToThrow does not modify assertion count #56

Open
ericb opened this issue Dec 22, 2022 · 1 comment
Open

expect callableNotToThrow does not modify assertion count #56

ericb opened this issue Dec 22, 2022 · 1 comment

Comments

@ericb
Copy link

ericb commented Dec 22, 2022

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants