generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Riley Aven
committed
Oct 28, 2024
1 parent
7efdb79
commit 6f79fa1
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/PackageServiceProviderTests/PackageOptimizationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
use Spatie\LaravelPackageTools\Package; | ||
use Spatie\LaravelPackageTools\Tests\TestClasses\FourthTestCommand; | ||
use Spatie\LaravelPackageTools\Tests\TestClasses\OtherTestCommand; | ||
use Spatie\LaravelPackageTools\Tests\TestClasses\TestCommand; | ||
use Spatie\LaravelPackageTools\Tests\TestClasses\ThirdTestCommand; | ||
|
||
trait ConfigurePackageOptimizationTest | ||
{ | ||
public function configurePackage(Package $package) | ||
{ | ||
$package->name('laravel-package-tools'); | ||
|
||
if (version_compare(app()->version(), '11.27.1', '>=')) { | ||
$package->hasOptimization(TestCommand::class, OtherTestCommand::class, 'laravel-package-tools'); | ||
} | ||
} | ||
} | ||
|
||
uses(ConfigurePackageOptimizationTest::class); | ||
|
||
it('can call optimize commands', function () { | ||
if (version_compare(app()->version(), '11.27.1', '<')) { | ||
$this->markTestSkipped('Laravel 11+ functionality'); | ||
} | ||
|
||
$this | ||
->artisan('test-command') | ||
->assertExitCode(0); | ||
}); | ||
|
||
it('can call optimize:clear commands', function () { | ||
if (version_compare(app()->version(), '11.27.1', '<')) { | ||
$this->markTestSkipped('Laravel 11+ functionality'); | ||
} | ||
|
||
$this | ||
->artisan('other-test-command') | ||
->assertExitCode(0); | ||
}); | ||
|
||
it('registered optimize with laravel', function() { | ||
if (version_compare(app()->version(), '11.27.1', '<')) { | ||
$this->markTestSkipped('Laravel 11+ functionality'); | ||
} | ||
|
||
$this->artisan('optimize')->expectsOutputToContain('laravel-package-tools'); | ||
}); | ||
|
||
it('registered optimize:clear with laravel', function() { | ||
if (version_compare(app()->version(), '11.27.1', '<')) { | ||
$this->markTestSkipped('Laravel 11+ functionality'); | ||
} | ||
|
||
$this->artisan('optimize:clear')->expectsOutputToContain('laravel-package-tools'); | ||
}); |