Skip to content

Commit

Permalink
Update assertion for L11
Browse files Browse the repository at this point in the history
  • Loading branch information
Riley Aven committed Oct 28, 2024
1 parent 7efdb79 commit 843620e
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use function PHPUnit\Framework\assertStringContainsString;
use Spatie\LaravelPackageTools\Commands\InstallCommand;
use Spatie\LaravelPackageTools\Package;
use function PHPUnit\Framework\assertStringNotContainsString;

trait ConfigureCopyAndRegisterServiceProviderInAppTest
{
Expand Down Expand Up @@ -36,18 +37,22 @@ function restoreAppConfigFile(): void
uses(ConfigureCopyAndRegisterServiceProviderInAppTest::class);

it('can copy and register the service provider in the app', function () {
if (intval(app()->version()) >= 11) {
$this->markTestSkipped('Respects Laravel 11 skeleton patterns');
}

$this
->artisan('package-tools:install')
->assertSuccessful();

assertStringContainsString(
"App\Providers\MyPackageServiceProvider::class",
file_get_contents(base_path('config/app.php'))
);
if (intval(app()->version()) >= 11) {
// This does not happen in L11 because of the different framework skeleton
assertStringNotContainsString(
"App\Providers\MyPackageServiceProvider::class",
file_get_contents(base_path('config/app.php'))
);
} else {
assertStringContainsString(
"App\Providers\MyPackageServiceProvider::class",
file_get_contents(base_path('config/app.php'))
);
}

restoreAppConfigFile();
});

0 comments on commit 843620e

Please sign in to comment.