From 9a48d139124e3d898d62e98b18fa36b8e1260442 Mon Sep 17 00:00:00 2001 From: ashleyhindle <454975+ashleyhindle@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:36:40 +0000 Subject: [PATCH 1/3] Update CHANGELOG --- CHANGELOG.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 516a2a02..54269d31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,19 @@ # Release Notes -## [Unreleased](https://github.com/laravel/boost/compare/v1.1.0...main) +## [Unreleased](https://github.com/laravel/boost/compare/v1.1.1...main) + +## [v1.1.1](https://github.com/laravel/boost/compare/v1.1.0...v1.1.1) - 2025-09-04 + +### What's Changed + +* Add strict types declaration in Inertia.php by [@felipeArnold](https://github.com/felipeArnold) in https://github.com/laravel/boost/pull/229 +* feat: update roster requirement, fixes #237 now phpunit will be detected by [@ashleyhindle](https://github.com/ashleyhindle) in https://github.com/laravel/boost/pull/239 + +### New Contributors + +* [@felipeArnold](https://github.com/felipeArnold) made their first contribution in https://github.com/laravel/boost/pull/229 + +**Full Changelog**: https://github.com/laravel/boost/compare/v1.1.0...v1.1.1 ## [v1.1.0](https://github.com/laravel/boost/compare/v1.0.21...v1.1.0) - 2025-09-04 From f1bbbb5cc3081f0a17f1d7fe47a5a901543d837f Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Thu, 4 Sep 2025 09:20:41 +0100 Subject: [PATCH 2/3] feat: add package priority guideline inclusion so Pest and PHPUnit don't conflict\n\nFixes #240 --- src/Install/GuidelineComposer.php | 33 ++++++++++++++++++ .../Feature/Install/GuidelineComposerTest.php | 34 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/src/Install/GuidelineComposer.php b/src/Install/GuidelineComposer.php index cb8a5513..982542b6 100644 --- a/src/Install/GuidelineComposer.php +++ b/src/Install/GuidelineComposer.php @@ -6,6 +6,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Blade; +use Laravel\Roster\Enums\Packages; use Laravel\Roster\Roster; use Symfony\Component\Finder\Exception\DirectoryNotFoundException; use Symfony\Component\Finder\Finder; @@ -21,6 +22,16 @@ class GuidelineComposer protected GuidelineAssist $guidelineAssist; + /** + * Package priority system to handle conflicts between packages. + * When a higher-priority package is present, lower-priority packages are excluded from guidelines. + * + * @var array + */ + protected array $packagePriorities = [ + Packages::PEST->value => [Packages::PHPUNIT->value], + ]; + public function __construct(protected Roster $roster, protected Herd $herd) { $this->config = new GuidelineConfig; @@ -118,6 +129,11 @@ protected function find(): Collection // Add all core and version specific docs for Roster supported packages // We don't add guidelines for packages unsupported by Roster right now foreach ($this->roster->packages() as $package) { + // Skip packages that should be excluded due to priority rules + if ($this->shouldExcludePackage($package->package()->value)) { + continue; + } + $guidelineDir = str_replace('_', '-', strtolower($package->name())); $guidelines->put( @@ -152,6 +168,23 @@ protected function find(): Collection ->where(fn (array $guideline) => ! empty(trim($guideline['content']))); } + /** + * Determines if a package should be excluded from guidelines based on priority rules. + */ + protected function shouldExcludePackage(string $packageName): bool + { + foreach ($this->packagePriorities as $priorityPackage => $excludedPackages) { + if (in_array($packageName, $excludedPackages)) { + $priorityEnum = Packages::from($priorityPackage); + if ($this->roster->uses($priorityEnum)) { + return true; + } + } + } + + return false; + } + /** * @param string $dirPath * @return array diff --git a/tests/Feature/Install/GuidelineComposerTest.php b/tests/Feature/Install/GuidelineComposerTest.php index 1c3b0dd2..12990e41 100644 --- a/tests/Feature/Install/GuidelineComposerTest.php +++ b/tests/Feature/Install/GuidelineComposerTest.php @@ -298,3 +298,37 @@ ->toContain('.ai/custom-rule') ->toContain('.ai/project-specific'); }); + +test('excludes PHPUnit guidelines when Pest is present due to package priority', function () { + $packages = new PackageCollection([ + new Package(Packages::LARAVEL, 'laravel/framework', '11.0.0'), + new Package(Packages::PEST, 'pestphp/pest', '3.0.0'), + new Package(Packages::PHPUNIT, 'phpunit/phpunit', '10.0.0'), + ]); + + $this->roster->shouldReceive('packages')->andReturn($packages); + $this->roster->shouldReceive('uses')->with(Packages::PEST)->andReturn(true); + + $guidelines = $this->composer->compose(); + + expect($guidelines) + ->toContain('=== pest/core rules ===') + ->not->toContain('=== phpunit/core rules ==='); +}); + +test('includes PHPUnit guidelines when Pest is not present', function () { + $packages = new PackageCollection([ + new Package(Packages::LARAVEL, 'laravel/framework', '11.0.0'), + new Package(Packages::PHPUNIT, 'phpunit/phpunit', '10.0.0'), + ]); + + $this->roster->shouldReceive('packages')->andReturn($packages); + $this->roster->shouldReceive('uses')->with(Packages::PEST)->andReturn(false); + + $guidelines = $this->composer->compose(); + + expect($guidelines) + ->toContain('=== phpunit/core rules ===') + ->not->toContain('=== pest/core rules ==='); +}); + From b670dbfee86b4905d57d70400b1b513ee7d5d2be Mon Sep 17 00:00:00 2001 From: ashleyhindle <454975+ashleyhindle@users.noreply.github.com> Date: Thu, 4 Sep 2025 08:21:05 +0000 Subject: [PATCH 3/3] Fix code styling --- tests/Feature/Install/GuidelineComposerTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Feature/Install/GuidelineComposerTest.php b/tests/Feature/Install/GuidelineComposerTest.php index 12990e41..adb4fe95 100644 --- a/tests/Feature/Install/GuidelineComposerTest.php +++ b/tests/Feature/Install/GuidelineComposerTest.php @@ -331,4 +331,3 @@ ->toContain('=== phpunit/core rules ===') ->not->toContain('=== pest/core rules ==='); }); -