assert icon indicating copy to clipboard operation
assert copied to clipboard

Fix error on `resource` assertion if message has a second placeholder

Open cs278 opened this issue 1 year ago • 1 comments

Prior to this change code such as Assert::resource(null, 'stream', 'Got: %s, type: %s') would fail as the second placeholder was only passed into sprintf() if the value supplied is a resource.

Test I've added without the code change fails with:

1) Webmozart\Assert\Tests\AssertTest::testResourceOfTypeCustomMessage
Failed asserting that exception of type "ArgumentCountError" matches expected exception "\InvalidArgumentException". Message was: "3 arguments are required, 2 given" at
<snip>/src/Assert.php:255
<snip>/tests/AssertTest.php:827

cs278 avatar Jun 13 '24 16:06 cs278

I came to the conclusion a bespoke test was needed but I might have missed something.

cs278 avatar Jun 13 '24 16:06 cs278

Great to see some activity here again, I've rebased this to pickup the CI changes.

cs278 avatar Oct 16 '24 16:10 cs278

Thank you!

shadowhand avatar Oct 16 '24 16:10 shadowhand