Upgrade Laravel to 5.8

This commit is contained in:
Phan An 2019-07-22 09:03:23 +02:00
parent f667f89699
commit 2a3129d3f3
28 changed files with 241 additions and 632 deletions

View file

@ -4,6 +4,7 @@ namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Arr;
/** /**
* Check if the app is running in an E2E session and use the proper data settings. * Check if the app is running in an E2E session and use the proper data settings.
@ -15,7 +16,7 @@ class UseDifferentConfigIfE2E
*/ */
public function handle(Request $request, Closure $next) public function handle(Request $request, Closure $next)
{ {
if (array_get($_SERVER, 'SERVER_PORT') === '8081') { if (Arr::get($_SERVER, 'SERVER_PORT') === '8081') {
config(['database.default' => 'sqlite-e2e']); config(['database.default' => 'sqlite-e2e']);
} }

View file

@ -30,7 +30,7 @@ class MediaCacheService
return $this->query(); return $this->query();
} }
return $this->cache->rememberForever(self::CACHE_KEY, function () { return $this->cache->rememberForever(self::CACHE_KEY, function (): array {
return $this->query(); return $this->query();
}); });
} }

View file

@ -6,7 +6,7 @@
"type": "project", "type": "project",
"require": { "require": {
"php": ">=7.1.3", "php": ">=7.1.3",
"laravel/framework": "5.7.*", "laravel/framework": "5.8.*",
"james-heinrich/getid3": "^1.9", "james-heinrich/getid3": "^1.9",
"guzzlehttp/guzzle": "^6.1", "guzzlehttp/guzzle": "^6.1",
"tymon/jwt-auth": "^0.5.6", "tymon/jwt-auth": "^0.5.6",
@ -20,7 +20,8 @@
"ext-json": "*", "ext-json": "*",
"ext-SimpleXML": "*", "ext-SimpleXML": "*",
"fideloper/proxy": "^4.0", "fideloper/proxy": "^4.0",
"daverandom/resume": "^0.0.3" "daverandom/resume": "^0.0.3",
"laravel/helpers": "^1.0"
}, },
"require-dev": { "require-dev": {
"filp/whoops": "~2.0", "filp/whoops": "~2.0",

696
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -24,14 +24,15 @@ class DownloadTest extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->createSampleMediaSet(); $this->createSampleMediaSet();
$this->downloadService = $this->mockIocDependency(DownloadService::class); $this->downloadService = $this->mockIocDependency(DownloadService::class);
} }
public function testDownloadOneSong() public function testDownloadOneSong(): void
{ {
$song = Song::first(); $song = Song::first();
@ -47,7 +48,7 @@ class DownloadTest extends TestCase
->assertResponseOk(); ->assertResponseOk();
} }
public function testDownloadMultipleSongs() public function testDownloadMultipleSongs(): void
{ {
$songs = Song::take(2)->orderBy('id')->get(); $songs = Song::take(2)->orderBy('id')->get();
@ -66,7 +67,7 @@ class DownloadTest extends TestCase
->assertResponseOk(); ->assertResponseOk();
} }
public function testDownloadAlbum() public function testDownloadAlbum(): void
{ {
$album = Album::first(); $album = Album::first();
@ -82,7 +83,7 @@ class DownloadTest extends TestCase
->assertResponseOk(); ->assertResponseOk();
} }
public function testDownloadArtist() public function testDownloadArtist(): void
{ {
$artist = Artist::first(); $artist = Artist::first();
@ -98,7 +99,7 @@ class DownloadTest extends TestCase
->assertResponseOk(); ->assertResponseOk();
} }
public function testDownloadPlaylist() public function testDownloadPlaylist(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
@ -122,7 +123,7 @@ class DownloadTest extends TestCase
->assertResponseOk(); ->assertResponseOk();
} }
public function testDownloadFavorites() public function testDownloadFavorites(): void
{ {
/** @var User $user */ /** @var User $user */
$user = factory(User::class)->create(); $user = factory(User::class)->create();

View file

@ -12,14 +12,14 @@ class InteractionTest extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->createSampleMediaSet(); $this->createSampleMediaSet();
} }
/** @test */ /** @test */
public function play_count_is_increased() public function play_count_is_increased(): void
{ {
$this->withoutEvents(); $this->withoutEvents();
$user = factory(User::class)->create(); $user = factory(User::class)->create();
@ -48,7 +48,7 @@ class InteractionTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function user_can_like_and_unlike_a_song() public function user_can_like_and_unlike_a_song(): void
{ {
$this->expectsEvents(SongLikeToggled::class); $this->expectsEvents(SongLikeToggled::class);
@ -78,7 +78,7 @@ class InteractionTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function user_can_like_and_unlike_songs_in_batch() public function user_can_like_and_unlike_songs_in_batch(): void
{ {
$this->expectsEvents(SongLikeToggled::class); $this->expectsEvents(SongLikeToggled::class);

View file

@ -20,7 +20,7 @@ class MediaSyncTest extends TestCase
/** @var MediaSyncService */ /** @var MediaSyncService */
private $mediaService; private $mediaService;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->mediaService = app(MediaSyncService::class); $this->mediaService = app(MediaSyncService::class);
@ -31,7 +31,7 @@ class MediaSyncTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function songs_can_be_synced() public function songs_can_be_synced(): void
{ {
$this->expectsEvents(LibraryChanged::class); $this->expectsEvents(LibraryChanged::class);
@ -97,7 +97,7 @@ class MediaSyncTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function songs_can_be_force_synced() public function songs_can_be_force_synced(): void
{ {
$this->expectsEvents(LibraryChanged::class); $this->expectsEvents(LibraryChanged::class);
@ -135,7 +135,7 @@ class MediaSyncTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function songs_can_be_synced_with_selectively_tags() public function songs_can_be_synced_with_selectively_tags(): void
{ {
$this->expectsEvents(LibraryChanged::class); $this->expectsEvents(LibraryChanged::class);
@ -164,7 +164,7 @@ class MediaSyncTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function all_tags_are_catered_for_if_syncing_new_file() public function all_tags_are_catered_for_if_syncing_new_file(): void
{ {
// First we sync the test directory to get the data // First we sync the test directory to get the data
$this->mediaService->sync($this->mediaPath); $this->mediaService->sync($this->mediaPath);
@ -189,7 +189,7 @@ class MediaSyncTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function added_song_is_synced_when_watching() public function added_song_is_synced_when_watching(): void
{ {
$this->expectsEvents(LibraryChanged::class); $this->expectsEvents(LibraryChanged::class);
@ -205,7 +205,7 @@ class MediaSyncTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function deleted_song_is_synced_when_watching() public function deleted_song_is_synced_when_watching(): void
{ {
$this->expectsEvents(LibraryChanged::class); $this->expectsEvents(LibraryChanged::class);
@ -222,7 +222,7 @@ class MediaSyncTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function deleted_directory_is_synced_when_watching() public function deleted_directory_is_synced_when_watching(): void
{ {
$this->expectsEvents(LibraryChanged::class); $this->expectsEvents(LibraryChanged::class);
@ -236,7 +236,7 @@ class MediaSyncTest extends TestCase
} }
/** @test */ /** @test */
public function html_entities_in_tags_are_recognized_and_saved_properly() public function html_entities_in_tags_are_recognized_and_saved_properly(): void
{ {
$this->mockIocDependency(getID3::class, [ $this->mockIocDependency(getID3::class, [
'analyze' => [ 'analyze' => [
@ -266,7 +266,7 @@ class MediaSyncTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function hidden_files_can_optionally_be_ignored_when_syncing() public function hidden_files_can_optionally_be_ignored_when_syncing(): void
{ {
config(['koel.ignore_dot_files' => false]); config(['koel.ignore_dot_files' => false]);
$this->mediaService->sync($this->mediaPath); $this->mediaService->sync($this->mediaPath);

View file

@ -15,13 +15,13 @@ class S3Test extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->disableMiddlewareForAllTests(); $this->disableMiddlewareForAllTests();
} }
public function testStoringASong() public function testStoringASong(): void
{ {
$this->post('api/os/s3/song', [ $this->post('api/os/s3/song', [
'bucket' => 'koel', 'bucket' => 'koel',
@ -40,7 +40,7 @@ class S3Test extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function testRemovingASong() public function testRemovingASong(): void
{ {
$this->expectsEvents(LibraryChanged::class); $this->expectsEvents(LibraryChanged::class);

View file

@ -12,13 +12,13 @@ class PlaylistTest extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->createSampleMediaSet(); $this->createSampleMediaSet();
} }
public function testCreatingPlaylist() public function testCreatingPlaylist(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
$songs = Song::orderBy('id')->take(3)->get(); $songs = Song::orderBy('id')->take(3)->get();
@ -51,7 +51,7 @@ class PlaylistTest extends TestCase
} }
/** @test */ /** @test */
public function user_can_update_a_playlists_name() public function user_can_update_a_playlists_name(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
@ -72,7 +72,7 @@ class PlaylistTest extends TestCase
} }
/** @test */ /** @test */
public function playlists_can_be_synced() public function playlists_can_be_synced(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
@ -109,7 +109,7 @@ class PlaylistTest extends TestCase
} }
/** @test */ /** @test */
public function user_can_delete_a_playlist() public function user_can_delete_a_playlist(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
@ -125,7 +125,7 @@ class PlaylistTest extends TestCase
} }
/** @test */ /** @test */
public function playlist_content_can_be_retrieved() public function playlist_content_can_be_retrieved(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();

View file

@ -11,14 +11,14 @@ class ProfileTest extends TestCase
/** @var MockInterface */ /** @var MockInterface */
private $hash; private $hash;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->hash = $this->mockIocDependency(Hasher::class); $this->hash = $this->mockIocDependency(Hasher::class);
} }
public function testUpdateProfileWithoutPassword() public function testUpdateProfileWithoutPassword(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
@ -29,7 +29,7 @@ class ProfileTest extends TestCase
$this->seeInDatabase('users', ['name' => 'Foo', 'email' => 'bar@baz.com']); $this->seeInDatabase('users', ['name' => 'Foo', 'email' => 'bar@baz.com']);
} }
public function testUpdateProfileWithPassword() public function testUpdateProfileWithPassword(): void
{ {
/** @var User $user */ /** @var User $user */
$user = factory(User::class)->create(); $user = factory(User::class)->create();

View file

@ -12,13 +12,13 @@ class SettingTest extends TestCase
/** @var MockInterface */ /** @var MockInterface */
private $mediaSyncService; private $mediaSyncService;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->mediaSyncService = $this->mockIocDependency(MediaSyncService::class); $this->mediaSyncService = $this->mockIocDependency(MediaSyncService::class);
} }
public function testSaveSettings() public function testSaveSettings(): void
{ {
$this->mediaSyncService->shouldReceive('sync')->once(); $this->mediaSyncService->shouldReceive('sync')->once();

View file

@ -14,7 +14,7 @@ class SongTest extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -24,7 +24,7 @@ class SongTest extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function testSingleUpdateAllInfoNoCompilation() public function testSingleUpdateAllInfoNoCompilation(): void
{ {
$this->expectsEvents(LibraryChanged::class); $this->expectsEvents(LibraryChanged::class);
$song = Song::orderBy('id', 'desc')->first(); $song = Song::orderBy('id', 'desc')->first();
@ -57,7 +57,7 @@ class SongTest extends TestCase
]); ]);
} }
public function testSingleUpdateSomeInfoNoCompilation() public function testSingleUpdateSomeInfoNoCompilation(): void
{ {
$song = Song::orderBy('id', 'desc')->first(); $song = Song::orderBy('id', 'desc')->first();
$originalArtistId = $song->album->artist->id; $originalArtistId = $song->album->artist->id;
@ -83,7 +83,7 @@ class SongTest extends TestCase
$this->assertEquals('One by One', Song::find($song->id)->album->name); $this->assertEquals('One by One', Song::find($song->id)->album->name);
} }
public function testMultipleUpdateAllInfoNoCompilation() public function testMultipleUpdateAllInfoNoCompilation(): void
{ {
$songIds = Song::orderBy('id', 'desc')->take(3)->pluck('id')->toArray(); $songIds = Song::orderBy('id', 'desc')->take(3)->pluck('id')->toArray();
@ -119,7 +119,7 @@ class SongTest extends TestCase
$this->assertEquals('John Cena', $songs[2]->album->artist->name); $this->assertEquals('John Cena', $songs[2]->album->artist->name);
} }
public function testMultipleUpdateSomeInfoNoCompilation() public function testMultipleUpdateSomeInfoNoCompilation(): void
{ {
$originalSongs = Song::orderBy('id', 'desc')->take(3)->get(); $originalSongs = Song::orderBy('id', 'desc')->take(3)->get();
$songIds = $originalSongs->pluck('id')->toArray(); $songIds = $originalSongs->pluck('id')->toArray();
@ -155,7 +155,7 @@ class SongTest extends TestCase
$this->assertEquals('John Cena', $songs[2]->album->artist->name); // And... JOHN CENAAAAAAAAAAA!!! $this->assertEquals('John Cena', $songs[2]->album->artist->name); // And... JOHN CENAAAAAAAAAAA!!!
} }
public function testSingleUpdateAllInfoYesCompilation() public function testSingleUpdateAllInfoYesCompilation(): void
{ {
$song = Song::orderBy('id', 'desc')->first(); $song = Song::orderBy('id', 'desc')->first();
@ -306,7 +306,7 @@ class SongTest extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function testDeletingByChunk() public function testDeletingByChunk(): void
{ {
$this->assertNotEquals(0, Song::count()); $this->assertNotEquals(0, Song::count());
$ids = Song::select('id')->get()->pluck('id')->all(); $ids = Song::select('id')->get()->pluck('id')->all();

View file

@ -21,7 +21,7 @@ abstract class TestCase extends BaseTestCase
/** @var JWTAuth */ /** @var JWTAuth */
private $auth; private $auth;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -86,7 +86,7 @@ abstract class TestCase extends BaseTestCase
return $this->auth->fromUser($user ?: factory(User::class)->create()); return $this->auth->fromUser($user ?: factory(User::class)->create());
} }
protected function tearDown() protected function tearDown(): void
{ {
$this->addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount()); $this->addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount());

View file

@ -11,13 +11,13 @@ class UserTest extends TestCase
/** @var MockInterface */ /** @var MockInterface */
private $hash; private $hash;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->hash = $this->mockIocDependency(Hasher::class); $this->hash = $this->mockIocDependency(Hasher::class);
} }
public function testNonAdminCannotCreateUser() public function testNonAdminCannotCreateUser(): void
{ {
$this->postAsUser('api/user', [ $this->postAsUser('api/user', [
'name' => 'Foo', 'name' => 'Foo',
@ -26,7 +26,7 @@ class UserTest extends TestCase
])->seeStatusCode(403); ])->seeStatusCode(403);
} }
public function testAdminCreatesUser() public function testAdminCreatesUser(): void
{ {
$this->hash $this->hash
->shouldReceive('make') ->shouldReceive('make')
@ -47,7 +47,7 @@ class UserTest extends TestCase
]); ]);
} }
public function testAdminUpdatesUser() public function testAdminUpdatesUser(): void
{ {
/** @var User $user */ /** @var User $user */
$user = factory(User::class)->create([ $user = factory(User::class)->create([
@ -76,7 +76,7 @@ class UserTest extends TestCase
]); ]);
} }
public function testAdminDeletesUser() public function testAdminDeletesUser(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
$admin = factory(User::class, 'admin')->create(); $admin = factory(User::class, 'admin')->create();
@ -85,7 +85,7 @@ class UserTest extends TestCase
->notSeeInDatabase('users', ['id' => $user->id]); ->notSeeInDatabase('users', ['id' => $user->id]);
} }
public function testSeppukuNotAllowed() public function testSeppukuNotAllowed(): void
{ {
$admin = factory(User::class, 'admin')->create(); $admin = factory(User::class, 'admin')->create();
@ -95,7 +95,7 @@ class UserTest extends TestCase
->seeInDatabase('users', ['id' => $admin->id]); ->seeInDatabase('users', ['id' => $admin->id]);
} }
public function testUpdateUserProfile() public function testUpdateUserProfile(): void
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
$this->assertNull($user->getPreference('foo')); $this->assertNull($user->getPreference('foo'));

View file

@ -13,7 +13,7 @@ class YouTubeTest extends TestCase
/** @var MockInterface */ /** @var MockInterface */
private $youTubeService; private $youTubeService;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();

View file

@ -17,7 +17,7 @@ class GenerateJwtSecretCommandTest extends TestCase
/** @var GenerateJwtSecretCommand */ /** @var GenerateJwtSecretCommand */
private $command; private $command;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -26,7 +26,7 @@ class GenerateJwtSecretCommandTest extends TestCase
app(Kernel::class)->registerCommand($this->command); app(Kernel::class)->registerCommand($this->command);
} }
public function testGenerateJwtSecret() public function testGenerateJwtSecret(): void
{ {
config(['jwt.secret' => false]); config(['jwt.secret' => false]);
@ -39,7 +39,7 @@ class GenerateJwtSecretCommandTest extends TestCase
$this->artisan('koel:generate-jwt-secret'); $this->artisan('koel:generate-jwt-secret');
} }
public function testNotRegenerateJwtSecret() public function testNotRegenerateJwtSecret(): void
{ {
config(['jwt.secret' => '12345678901234567890123456789012']); config(['jwt.secret' => '12345678901234567890123456789012']);

View file

@ -18,7 +18,7 @@ class StreamerFactoryTest extends TestCase
/** @var StreamerFactory */ /** @var StreamerFactory */
private $streamerFactory; private $streamerFactory;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->streamerFactory = app(StreamerFactory::class); $this->streamerFactory = app(StreamerFactory::class);

View file

@ -14,7 +14,7 @@ class DownloadAlbumCoverTest extends TestCase
/** @var MediaMetadataService|MockInterface */ /** @var MediaMetadataService|MockInterface */
private $mediaMetaDataService; private $mediaMetaDataService;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -22,7 +22,7 @@ class DownloadAlbumCoverTest extends TestCase
PHPMockery::mock('App\Listeners', 'ini_get')->andReturn(true); PHPMockery::mock('App\Listeners', 'ini_get')->andReturn(true);
} }
public function testHandle() public function testHandle(): void
{ {
$album = factory(Album::class)->make(['cover' => null]); $album = factory(Album::class)->make(['cover' => null]);
$event = new AlbumInformationFetched($album, ['image' => 'https://foo.bar/baz.jpg']); $event = new AlbumInformationFetched($album, ['image' => 'https://foo.bar/baz.jpg']);

View file

@ -14,7 +14,7 @@ class DownloadArtistImageTest extends TestCase
/** @var MediaMetadataService|MockInterface */ /** @var MediaMetadataService|MockInterface */
private $mediaMetaDataService; private $mediaMetaDataService;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -22,7 +22,7 @@ class DownloadArtistImageTest extends TestCase
PHPMockery::mock('App\Listeners', 'ini_get')->andReturn(true); PHPMockery::mock('App\Listeners', 'ini_get')->andReturn(true);
} }
public function testHandle() public function testHandle(): void
{ {
$artist = factory(Artist::class)->make(['image' => null]); $artist = factory(Artist::class)->make(['image' => null]);
$event = new ArtistInformationFetched($artist, ['image' => 'https://foo.bar/baz.jpg']); $event = new ArtistInformationFetched($artist, ['image' => 'https://foo.bar/baz.jpg']);

View file

@ -19,7 +19,7 @@ class SongRepositoryTest extends TestCase
*/ */
private $songRepository; private $songRepository;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->helperService = new HelperService(); $this->helperService = new HelperService();

View file

@ -10,13 +10,13 @@ class FileSynchronizerTest extends TestCase
/** @var FileSynchronizer */ /** @var FileSynchronizer */
private $fileSynchronizer; private $fileSynchronizer;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->fileSynchronizer = app(FileSynchronizer::class); $this->fileSynchronizer = app(FileSynchronizer::class);
} }
public function testGetFileInfo() public function testGetFileInfo(): void
{ {
$info = $this->fileSynchronizer->setFile(__DIR__.'/../../songs/full.mp3')->getFileInfo(); $info = $this->fileSynchronizer->setFile(__DIR__.'/../../songs/full.mp3')->getFileInfo();
@ -48,7 +48,7 @@ class FileSynchronizerTest extends TestCase
} }
/** @test */ /** @test */
public function song_without_a_title_tag_has_file_name_as_the_title() public function song_without_a_title_tag_has_file_name_as_the_title(): void
{ {
$this->fileSynchronizer->setFile(__DIR__.'/../../songs/blank.mp3'); $this->fileSynchronizer->setFile(__DIR__.'/../../songs/blank.mp3');
self::assertSame('blank', $this->fileSynchronizer->getFileInfo()['title']); self::assertSame('blank', $this->fileSynchronizer->getFileInfo()['title']);

View file

@ -18,7 +18,7 @@ class InteractionServiceTest extends TestCase
*/ */
private $interactionService; private $interactionService;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -26,7 +26,7 @@ class InteractionServiceTest extends TestCase
} }
/** @test */ /** @test */
public function it_increases_a_songs_play_count() public function it_increases_a_songs_play_count(): void
{ {
/** @var Interaction $interaction */ /** @var Interaction $interaction */
$interaction = factory(Interaction::class)->create(); $interaction = factory(Interaction::class)->create();
@ -43,7 +43,7 @@ class InteractionServiceTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function it_toggles_like_status() public function it_toggles_like_status(): void
{ {
$this->expectsEvents(SongLikeToggled::class); $this->expectsEvents(SongLikeToggled::class);
@ -61,7 +61,7 @@ class InteractionServiceTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function user_can_like_multiple_songs_at_once() public function user_can_like_multiple_songs_at_once(): void
{ {
$this->expectsEvents(SongLikeToggled::class); $this->expectsEvents(SongLikeToggled::class);
@ -81,7 +81,7 @@ class InteractionServiceTest extends TestCase
* *
* @throws Exception * @throws Exception
*/ */
public function user_can_unlike_multiple_songs_at_once() public function user_can_unlike_multiple_songs_at_once(): void
{ {
$this->expectsEvents(SongLikeToggled::class); $this->expectsEvents(SongLikeToggled::class);

View file

@ -23,7 +23,7 @@ class MediaCacheServiceTest extends TestCase
*/ */
private $cache; private $cache;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -31,7 +31,7 @@ class MediaCacheServiceTest extends TestCase
$this->mediaCacheService = new MediaCacheService($this->cache); $this->mediaCacheService = new MediaCacheService($this->cache);
} }
public function testGetIfCacheIsNotAvailable() public function testGetIfCacheIsNotAvailable(): void
{ {
factory(Song::class, 5)->create(); factory(Song::class, 5)->create();
@ -48,7 +48,7 @@ class MediaCacheServiceTest extends TestCase
$this->assertCount(5, $data['songs']); $this->assertCount(5, $data['songs']);
} }
public function testGetIfCacheIsAvailable() public function testGetIfCacheIsAvailable(): void
{ {
$this->cache->shouldReceive('rememberForever')->andReturn(['dummy']); $this->cache->shouldReceive('rememberForever')->andReturn(['dummy']);
@ -59,7 +59,7 @@ class MediaCacheServiceTest extends TestCase
$this->assertEquals(['dummy'], $data); $this->assertEquals(['dummy'], $data);
} }
public function testCacheDisabled() public function testCacheDisabled(): void
{ {
$this->cache->shouldReceive('rememberForever')->never(); $this->cache->shouldReceive('rememberForever')->never();

View file

@ -25,7 +25,7 @@ class MediaInformationServiceTest extends TestCase
*/ */
private $mediaInformationService; private $mediaInformationService;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -36,7 +36,7 @@ class MediaInformationServiceTest extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function testGetAlbumInformation() public function testGetAlbumInformation(): void
{ {
$this->expectsEvents(AlbumInformationFetched::class); $this->expectsEvents(AlbumInformationFetched::class);
@ -60,7 +60,7 @@ class MediaInformationServiceTest extends TestCase
/** /**
* @throws Exception * @throws Exception
*/ */
public function testGetArtistInformation() public function testGetArtistInformation(): void
{ {
$this->expectsEvents(ArtistInformationFetched::class); $this->expectsEvents(ArtistInformationFetched::class);

View file

@ -14,7 +14,7 @@ class MediaMetadataServiceTest extends TestCase
/** @var MediaMetadataService */ /** @var MediaMetadataService */
private $mediaMetadataService; private $mediaMetadataService;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->mediaMetadataService = new MediaMetadataService(app(Logger::class)); $this->mediaMetadataService = new MediaMetadataService(app(Logger::class));

View file

@ -29,7 +29,7 @@ class S3ServiceTest extends TestCase
*/ */
private $s3Service; private $s3Service;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->s3Client = Mockery::mock(S3ClientInterface::class); $this->s3Client = Mockery::mock(S3ClientInterface::class);

View file

@ -11,13 +11,13 @@ abstract class TestCase extends BaseTestCase
{ {
use DatabaseTransactions, CreatesApplication, InteractsWithIoc; use DatabaseTransactions, CreatesApplication, InteractsWithIoc;
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->prepareForTests(); $this->prepareForTests();
} }
protected function tearDown() protected function tearDown(): void
{ {
$this->addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount()); $this->addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount());

View file

@ -6,14 +6,14 @@ use Tests\TestCase;
class ApplicationTest extends TestCase class ApplicationTest extends TestCase
{ {
public function setUp() public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@unlink(app()->publicPath().'/public/hot'); @unlink(app()->publicPath().'/public/hot');
} }
/** @test */ /** @test */
public function static_urls_without_cdn_are_constructed_correctly() public function static_urls_without_cdn_are_constructed_correctly(): void
{ {
// Given we are not using a CDN // Given we are not using a CDN
config(['koel.cdn.url' => '']); config(['koel.cdn.url' => '']);
@ -28,7 +28,7 @@ class ApplicationTest extends TestCase
} }
/** @test */ /** @test */
public function static_urls_with_cdn_are_constructed_correctly() public function static_urls_with_cdn_are_constructed_correctly(): void
{ {
// Given we're using a CDN // Given we're using a CDN
config(['koel.cdn.url' => 'http://cdn.tld']); config(['koel.cdn.url' => 'http://cdn.tld']);
@ -43,7 +43,7 @@ class ApplicationTest extends TestCase
} }
/** @test */ /** @test */
public function application_asset_revision_urls_are_constructed_correctly_when_not_using_cdn() public function application_asset_revision_urls_are_constructed_correctly_when_not_using_cdn(): void
{ {
// Given we have revisioned assets in the manifest file // Given we have revisioned assets in the manifest file
$manifestFile = __DIR__.'../../blobs/rev-manifest.json'; $manifestFile = __DIR__.'../../blobs/rev-manifest.json';
@ -59,7 +59,7 @@ class ApplicationTest extends TestCase
} }
/** @test */ /** @test */
public function application_asset_revision_urls_are_constructed_correctly_when_using_cdn() public function application_asset_revision_urls_are_constructed_correctly_when_using_cdn(): void
{ {
// Given we have revisioned assets in the manifest file // Given we have revisioned assets in the manifest file
$manifestFile = __DIR__.'../../blobs/rev-manifest.json'; $manifestFile = __DIR__.'../../blobs/rev-manifest.json';