/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Foundation/Console/OptimizeClearCommandTest.php
52 строки
1 KB
Luke Kuzmish
[11.x] Fix deprecation warnings in `optimize:clear` and `optimize` (#54197)
15 янв 2025, 22:36
Не верифицирован
15 янв 2025, 22:36
5107066
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Foundation\Console; use Illuminate\Foundation\Console\ClosureCommand; use Illuminate\Support\ServiceProvider; use Illuminate\Tests\Integration\Generators\TestCase; class OptimizeClearCommandTest extends TestCase { protected function getPackageProviders($app): array { return [ServiceProviderWithOptimizeClear::class]; } public function testCanListenToOptimizingEvent(): void { $this->withoutDeprecationHandling(); $this->artisan('optimize:clear') ->assertSuccessful() ->expectsOutputToContain('ServiceProviderWithOptimizeClear'); } public function testCanExcludeCommandsByKey(): void { $this->artisan('optimize:clear', ['--except' => 'my package']) ->assertSuccessful() ->doesntExpectOutputToContain('my package'); } public function testCanExcludeCommandsByCommand(): void { $this->artisan('optimize:clear', ['--except' => 'my_package:cache']) ->assertSuccessful() ->doesntExpectOutputToContain('my_package:cache'); } } class ServiceProviderWithOptimizeClear extends ServiceProvider { public function boot(): void { $this->commands([ new ClosureCommand('my_package:clear', fn () => 0), ]); $this->optimizes( clear: 'my_package:clear', ); } }