|
14 | 14 | use App\Concerns\Sanitizer; |
15 | 15 | use App\Music\SequenceMusic; |
16 | 16 | use Illuminate\Support\Arr; |
17 | | -use Illuminate\Support\Facades\File; |
18 | 17 | use Laravel\Prompts\Prompt; |
19 | 18 |
|
20 | 19 | uses(Sanitizer::class); |
21 | 20 |
|
22 | 21 | beforeEach(function (): void { |
23 | | - Prompt::fallbackWhen(true); |
| 22 | + // Prompt::fallbackWhen(true); |
24 | 23 | }); |
25 | 24 |
|
26 | | -it('can search and download music', function ($originalSongs): void { |
| 25 | +it('can search and download music', function ($songs): void { |
27 | 26 | $mockSequenceMusic = Mockery::mock(SequenceMusic::class); |
28 | | - $mockSequenceMusic->allows('search')->andReturn(collect($originalSongs)); |
| 27 | + $mockSequenceMusic->allows('search')->andReturn(collect($songs)); |
29 | 28 | $mockSequenceMusic->allows('download')->andReturnUndefined(); |
30 | 29 | App\Facades\Music::shouldReceive('driver')->andReturn($mockSequenceMusic->makePartial()); |
31 | 30 |
|
32 | | - $options = $this->sanitizes(collect($originalSongs), '不只是南方') |
| 31 | + $options = $this->sanitizes(collect($songs), '不只是南方') |
33 | 32 | ->transform(static fn (array $song): string => implode(' ', Arr::except($song, [0]))) |
34 | 33 | ->prepend(config('music-dl.all_songs')); |
35 | 34 | $this |
36 | 35 | ->artisan(MusicCommand::class, [ |
37 | 36 | 'keyword' => '不只是南方', |
38 | 37 | '--dir' => downloads_path(), |
39 | | - // '--driver' => 'fork', |
| 38 | + '--driver' => 'sequence', |
40 | 39 | '--no-continue' => true, |
41 | 40 | '--sources' => 'netease', |
42 | 41 | ]) |
43 | 42 | ->expectsConfirmation(config('music-dl.confirm_label'), 'yes') |
44 | 43 | // ->expectsQuestion(config('music-dl.select_label'), [config('music-dl.all_songs')]) |
45 | 44 | ->expectsChoice(config('music-dl.select_label'), [config('music-dl.all_songs')], $options->all()) |
46 | 45 | ->assertSuccessful(); |
47 | | -})->group(__DIR__, __FILE__)->with('originalSongs'); |
| 46 | +})->group(__DIR__, __FILE__)->with('songs'); |
0 commit comments