laravel/dusk

assertStringContainsString doesn't display the specified message

efcor opened this issue · 3 comments

Dusk Version

8.2.9

Laravel Version

11.28.1

PHP Version

8.3.12

PHPUnit Version

11.4.2

Database Driver & Version

No response

Description

When doing $this->assertStringContainsString('foo', 'bar', 'My custom message.'); in a test, Dusk's output for that test does not display "My custom message." I double checked and assertStringContainsString does have a third parameter for a message, similar to assertSame.

If you do $this->assertSame('foo', 'bar', 'My custom message.'); in a test, Dusk's output for that test will render "My custom message" as expected.

$this->assertSame('foo', 'bar', 'My custom message.');

Screenshot 2024-10-21 at 11 53 06 AM

$this->assertStringContainsString('foo', 'bar', 'My custom message.');
Screenshot 2024-10-21 at 11 53 22 AM

Steps To Reproduce

Be on Mac OS 14.6.1 (Apple Silicon)
Have Chrome Version 130.0.6723.59 (Official Build) (arm64)

Run:
laravel new laravel (no scaffolding etc in the wizard)
composer require laravel/dusk --dev
cd laravel
herd link

php artisan dusk:install
php artisan dusk:chrome-driver

Add $this->assertStringContainsString('foo', 'bar', 'My custom message.'); to the Tests\Browser\ExampleTest test.

Run php artisan dusk.

Can you test if the output is the same after composer remove nunomaduro/collision --dev?

The output does contain the "My custom message" after doing that.

Screenshot 2024-10-23 at 1 44 23 PM

nunomaduro/collision overrides PHPUnit's default printer, I believe this should and can only be solved by reporting the issue to the correct repository: https://github.com/nunomaduro/collision/