Skip to content

Fix PHPUnit notice use stub over mock on DocumentationMenuFactoryTest#3699

Merged
samsonasik merged 1 commit into
mainfrom
fix-phpunit-notice-stub-over-mock
May 18, 2026
Merged

Fix PHPUnit notice use stub over mock on DocumentationMenuFactoryTest#3699
samsonasik merged 1 commit into
mainfrom
fix-phpunit-notice-stub-over-mock

Conversation

@samsonasik
Copy link
Copy Markdown
Member

Before

vendor/bin/phpunit --display-phpunit-notices
PHPUnit 13.0.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.21
Configuration: /Users/samsonasik/www/getrector-com/phpunit.xml

..........................NN............................          56 / 56 (100%)

Time: 00:09.883, Memory: 93.00 MB

2 tests triggered 2 PHPUnit notices:

1) App\Tests\Documentation\DocumentationMenuFactoryTest::testSectionTitle
No expectations were configured for the mock object for Illuminate\Contracts\Routing\UrlGenerator. Consider refactoring your test code to use a test stub instead. The #[AllowMockObjectsWithoutExpectations] attribute can be used to opt out of this check.

/Users/samsonasik/www/getrector-com/tests/Documentation/DocumentationMenuFactoryTest.php:29

2) App\Tests\Documentation\DocumentationMenuFactoryTest::testCategory
No expectations were configured for the mock object for Illuminate\Contracts\Routing\UrlGenerator. Consider refactoring your test code to use a test stub instead. The #[AllowMockObjectsWithoutExpectations] attribute can be used to opt out of this check.

/Users/samsonasik/www/getrector-com/tests/Documentation/DocumentationMenuFactoryTest.php:35

OK, but there were issues!
Tests: 56, Assertions: 120, PHPUnit Notices: 2.

After

vendor/bin/phpunit --display-phpunit-notices
PHPUnit 13.0.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.21
Configuration: /Users/samsonasik/www/getrector-com/phpunit.xml

........................................................          56 / 56 (100%)

Time: 00:09.859, Memory: 93.00 MB

OK (56 tests, 120 assertions)

@samsonasik samsonasik changed the title Fix PHPUnit notice use stub over mock Fix PHPUnit notice use stub over mock on DocumentationMenuFactoryTest May 18, 2026
@samsonasik
Copy link
Copy Markdown
Member Author

All green 🎉 @TomasVotruba let's merge ;)

@samsonasik samsonasik merged commit 3824615 into main May 18, 2026
8 checks passed
@samsonasik samsonasik deleted the fix-phpunit-notice-stub-over-mock branch May 18, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant