File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,8 +186,8 @@ protected function clearAssetsPublicDirectoryOnPublish(): void
186186 {
187187 Event::listen (CommandStarting::class, function (CommandStarting $ event ) {
188188 if ($ event ->command === 'vendor:publish '
189- && $ event ->input ->getOption ('tag ' )
190- && in_array ( ' sharp-assets ' , $ event ->input ->getOption ('tag ' ))
189+ && $ event ->input ->hasOption ('tag ' )
190+ && collect ( $ event ->input ->getOption ('tag ' ))-> contains ( ' sharp-assets ' )
191191 ) {
192192 if (File::exists (public_path ('vendor/sharp ' ))) {
193193 File::deleteDirectory (public_path ('vendor/sharp ' ));
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Illuminate \Console \Events \CommandFinished ;
4+ use Illuminate \Foundation \Testing \WithConsoleEvents ;
5+ use Illuminate \Support \Facades \Event ;
6+
7+ uses (WithConsoleEvents::class);
8+
9+ beforeEach (function () {
10+ login ();
11+ });
12+
13+ it ('allows to update assets ' , function () {
14+ $ commandFinishedEvent = null ;
15+ Event::listen (function (CommandFinished $ event ) use (&$ commandFinishedEvent ) {
16+ $ commandFinishedEvent = $ event ;
17+ });
18+
19+ $ this
20+ ->from ('/sharp/s-list/person ' )
21+ ->post (route ('code16.sharp.update-assets ' ))
22+ ->assertRedirect ('/sharp/s-list/person ' )
23+ ->assertSessionHas ('sharp_notifications ' );
24+
25+ expect ($ commandFinishedEvent )
26+ ->toBeInstanceOf (CommandFinished::class)
27+ ->and ($ commandFinishedEvent ->command )->toBe ('vendor:publish ' )
28+ ->and ($ commandFinishedEvent ->exitCode )->toBe (0 );
29+
30+ $ notifications = session ('sharp_notifications ' );
31+ $ notification = collect ($ notifications )->first ();
32+ expect ($ notification ['title ' ])->toBe ('Assets updated successfully ' )
33+ ->and ($ notification ['level ' ]->value )->toBe ('success ' );
34+ });
You can’t perform that action at this time.
0 commit comments