Skip to content

Commit

Permalink
fix(app): remove unused MusicManager references
Browse files Browse the repository at this point in the history
- Delete the _ide_helper.php file which contained the MusicManager class.
- Remove references to MusicManager in AppServiceProvider and app.php.
- Clean up the codebase by eliminating unnecessary singleton registrations.
  • Loading branch information
guanguans committed Sep 23, 2024
1 parent fb07b17 commit 9f95de6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 30 deletions.
20 changes: 0 additions & 20 deletions _ide_helper.php

This file was deleted.

5 changes: 1 addition & 4 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace App\Providers;

use App\MusicManager;
use Illuminate\Console\OutputStyle;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Traits\Conditionable;
Expand All @@ -32,9 +31,7 @@ final class AppServiceProvider extends ServiceProvider
*
* @var array<class-string|int, class-string>
*/
public array $singletons = [
// MusicManager::class,
];
public array $singletons = [];

/**
* Register any application services.
Expand Down
4 changes: 0 additions & 4 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use App\Contracts\Music as MusicContract;
use App\Music;
use App\MusicManager;
use App\Support\Meting;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Log\LogManager;
Expand All @@ -23,9 +22,6 @@
use Psr\Log\LoggerInterface;

return Application::configure(basePath: \dirname(__DIR__))
->withSingletons([
MusicManager::class,
])
->booted(static function (Application $app): void {
$app->singleton(
Music::class,
Expand Down
10 changes: 8 additions & 2 deletions tests/Unit/MusicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@
use GuzzleHttp\Exception\TransferException;
use Illuminate\Support\Collection;

it('can search songs', function (): void {
it('can search songs', function (Collection $songs): void {
// $this->app->singleton(Music::class, static function () use ($songs) {
// $mockMusic = \Mockery::mock(Music::class);
// $mockMusic->allows('search')->andReturn($songs);
//
// return $mockMusic->makePartial();
// });
expect(app(Music::class))->search('腰乐队', config('app.sources'))->toBeInstanceOf(Collection::class);
})->group(__DIR__, __FILE__);
})->group(__DIR__, __FILE__)->with('songs');

it('will throw exception when download failed', function (): void {
try {
Expand Down

0 comments on commit 9f95de6

Please sign in to comment.