From 723e9402ac08b80bed233f86a6b28b3255827d95 Mon Sep 17 00:00:00 2001 From: Buster Neece Date: Thu, 8 Jun 2023 09:22:50 -0500 Subject: [PATCH] Apply scanning to more files. --- phpcs.xml | 15 +++-- phpstan.neon | 4 ++ src/Tests/Connector.php | 2 +- src/Tests/Module.php | 5 +- tests/Functional/Admin_DebugCest.php | 6 +- tests/Functional/Admin_IndexCest.php | 6 +- tests/Functional/Admin_RecordsCest.php | 10 ++- tests/Functional/Api_Admin_AuditLogCest.php | 6 +- .../Functional/Api_Admin_CustomFieldsCest.php | 6 +- tests/Functional/Api_Admin_RolesCest.php | 7 +- tests/Functional/Api_Admin_StationsCest.php | 5 +- .../Api_Admin_StorageLocationsCest.php | 5 +- tests/Functional/Api_Admin_UsersCest.php | 6 +- tests/Functional/Api_Frontend_AccountCest.php | 6 +- .../Functional/Api_Frontend_DashboardCest.php | 6 +- tests/Functional/Api_IndexCest.php | 6 +- tests/Functional/Api_StationsCest.php | 6 +- tests/Functional/Api_Stations_MountsCest.php | 6 +- .../Functional/Api_Stations_PlaylistsCest.php | 5 +- .../Functional/Api_Stations_PodcastsCest.php | 6 +- tests/Functional/Api_Stations_RemotesCest.php | 5 +- tests/Functional/Api_Stations_ReportsCest.php | 29 +++++---- .../Functional/Api_Stations_StreamersCest.php | 6 +- .../Functional/Api_Stations_WebhooksCest.php | 5 +- tests/Functional/CestAbstract.php | 64 +++++++++++-------- tests/Functional/Frontend_ErrorCest.php | 6 +- tests/Functional/Frontend_IndexCest.php | 6 +- tests/Functional/Frontend_PublicCest.php | 6 +- tests/Functional/Frontend_SetupCest.php | 12 ++-- tests/Functional/Station_MediaCest.php | 6 +- tests/Functional/Station_MountPointsCest.php | 6 +- tests/Functional/Station_PlaylistsCest.php | 6 +- tests/Functional/Station_ProfileCest.php | 6 +- tests/Functional/Station_RemoteRelaysCest.php | 6 +- tests/Functional/Station_ReportsCest.php | 6 +- tests/Functional/_bootstrap.php | 5 +- tests/Unit/DuplicatePreventionTest.php | 5 +- tests/Unit/ListenerIntervalTest.php | 5 +- tests/Unit/StationPlaylistTest.php | 30 +++++---- tests/Unit/UtilitiesTest.php | 2 + tests/Unit/XmlTest.php | 2 + tests/Unit/_bootstrap.php | 3 + 42 files changed, 257 insertions(+), 94 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index 14cbb9844..f8b620bfb 100755 --- a/phpcs.xml +++ b/phpcs.xml @@ -2,13 +2,11 @@ The AzuraCast PHP coding standard. - bin config src - templates web - - src/Tests/*$ + tests/Functional + tests/Unit @@ -35,6 +33,15 @@ src/Installer/EnvFiles/*.php + + tests/*$ + + + + src/Tests/Module.php + tests/*$ + + diff --git a/phpstan.neon b/phpstan.neon index c005cff52..bbf388322 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -14,6 +14,10 @@ parameters: - templates - web + fileExtensions: + - "" + - php + excludePaths: - config/routes.dev.php diff --git a/src/Tests/Connector.php b/src/Tests/Connector.php index d1698b5a2..9020140f3 100644 --- a/src/Tests/Connector.php +++ b/src/Tests/Connector.php @@ -53,7 +53,7 @@ class Connector extends AbstractBrowser $_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod()); $_SERVER['REQUEST_URI'] = $uri; - $request = (new ServerRequestFactory)->createServerRequestFromGlobals(); + $request = (new ServerRequestFactory())->createServerRequestFromGlobals(); $slimResponse = $this->app->handle($request); diff --git a/src/Tests/Module.php b/src/Tests/Module.php index 7248e71f1..45f2816ca 100644 --- a/src/Tests/Module.php +++ b/src/Tests/Module.php @@ -1,11 +1,12 @@ requiredFields = ['container']; } + public function _initialize(): void { $this->app = AppFactory::createApp( diff --git a/tests/Functional/Admin_DebugCest.php b/tests/Functional/Admin_DebugCest.php index fc1261b8f..f80edba35 100644 --- a/tests/Functional/Admin_DebugCest.php +++ b/tests/Functional/Admin_DebugCest.php @@ -1,14 +1,18 @@ wantTo('Test All Synchronized Tasks'); $I->amOnPage('/admin/debug/sync/all'); diff --git a/tests/Functional/Admin_IndexCest.php b/tests/Functional/Admin_IndexCest.php index 4960ce43a..638ba8b85 100644 --- a/tests/Functional/Admin_IndexCest.php +++ b/tests/Functional/Admin_IndexCest.php @@ -1,14 +1,18 @@ wantTo('See the administration homepage.'); diff --git a/tests/Functional/Admin_RecordsCest.php b/tests/Functional/Admin_RecordsCest.php index 788d5eb40..0d89d2bd6 100644 --- a/tests/Functional/Admin_RecordsCest.php +++ b/tests/Functional/Admin_RecordsCest.php @@ -1,14 +1,18 @@ wantTo('Manage users.'); @@ -52,7 +56,7 @@ class Admin_RecordsCest extends CestAbstract * @before setupComplete * @before login */ - public function manageStations(\FunctionalTester $I): void + public function manageStations(FunctionalTester $I): void { $I->wantTo('Manage stations.'); @@ -79,7 +83,7 @@ class Admin_RecordsCest extends CestAbstract * @before setupComplete * @before login */ - public function manageSettings(\FunctionalTester $I): void + public function manageSettings(FunctionalTester $I): void { $I->wantTo('Manage settings.'); diff --git a/tests/Functional/Api_Admin_AuditLogCest.php b/tests/Functional/Api_Admin_AuditLogCest.php index 9a718d4f6..f9cbe3dcb 100644 --- a/tests/Functional/Api_Admin_AuditLogCest.php +++ b/tests/Functional/Api_Admin_AuditLogCest.php @@ -1,14 +1,18 @@ wantTo('View audit log via API.'); diff --git a/tests/Functional/Api_Admin_CustomFieldsCest.php b/tests/Functional/Api_Admin_CustomFieldsCest.php index c9e7ecc93..02cd120c1 100644 --- a/tests/Functional/Api_Admin_CustomFieldsCest.php +++ b/tests/Functional/Api_Admin_CustomFieldsCest.php @@ -1,14 +1,18 @@ wantTo('Manage custom fields via API.'); diff --git a/tests/Functional/Api_Admin_RolesCest.php b/tests/Functional/Api_Admin_RolesCest.php index 6af4c015d..0255ba7e1 100644 --- a/tests/Functional/Api_Admin_RolesCest.php +++ b/tests/Functional/Api_Admin_RolesCest.php @@ -1,9 +1,12 @@ wantTo('Manage roles via API.'); @@ -32,7 +35,7 @@ class Api_Admin_RolesCest extends CestAbstract ); } - public function checkSuperAdminRole(\FunctionalTester $I): void + public function checkSuperAdminRole(FunctionalTester $I): void { $I->wantTo('Ensure super administrator is not editable.'); diff --git a/tests/Functional/Api_Admin_StationsCest.php b/tests/Functional/Api_Admin_StationsCest.php index 139cb3a89..040de1f71 100644 --- a/tests/Functional/Api_Admin_StationsCest.php +++ b/tests/Functional/Api_Admin_StationsCest.php @@ -1,8 +1,11 @@ wantTo('Manage stations via API.'); diff --git a/tests/Functional/Api_Admin_StorageLocationsCest.php b/tests/Functional/Api_Admin_StorageLocationsCest.php index 292624e22..eabd66751 100644 --- a/tests/Functional/Api_Admin_StorageLocationsCest.php +++ b/tests/Functional/Api_Admin_StorageLocationsCest.php @@ -1,9 +1,12 @@ wantTo('Manage storage locations via API.'); diff --git a/tests/Functional/Api_Admin_UsersCest.php b/tests/Functional/Api_Admin_UsersCest.php index 7d4f0b340..64f4cd883 100644 --- a/tests/Functional/Api_Admin_UsersCest.php +++ b/tests/Functional/Api_Admin_UsersCest.php @@ -1,14 +1,18 @@ wantTo('Manage users via API.'); diff --git a/tests/Functional/Api_Frontend_AccountCest.php b/tests/Functional/Api_Frontend_AccountCest.php index 91e34df77..c4dc1280c 100644 --- a/tests/Functional/Api_Frontend_AccountCest.php +++ b/tests/Functional/Api_Frontend_AccountCest.php @@ -1,14 +1,18 @@ wantTo('Check frontend account API functions.'); diff --git a/tests/Functional/Api_Frontend_DashboardCest.php b/tests/Functional/Api_Frontend_DashboardCest.php index a29c51246..cde4c2429 100644 --- a/tests/Functional/Api_Frontend_DashboardCest.php +++ b/tests/Functional/Api_Frontend_DashboardCest.php @@ -1,14 +1,18 @@ wantTo('Check dashboard API functions.'); diff --git a/tests/Functional/Api_IndexCest.php b/tests/Functional/Api_IndexCest.php index 7e222fc44..58ce65304 100644 --- a/tests/Functional/Api_IndexCest.php +++ b/tests/Functional/Api_IndexCest.php @@ -1,13 +1,17 @@ wantTo('Check basic API functions.'); diff --git a/tests/Functional/Api_StationsCest.php b/tests/Functional/Api_StationsCest.php index cbfb19103..23518bc61 100644 --- a/tests/Functional/Api_StationsCest.php +++ b/tests/Functional/Api_StationsCest.php @@ -1,13 +1,17 @@ wantTo('Check station API endpoints.'); diff --git a/tests/Functional/Api_Stations_MountsCest.php b/tests/Functional/Api_Stations_MountsCest.php index 79811f2a7..e0e178e2a 100644 --- a/tests/Functional/Api_Stations_MountsCest.php +++ b/tests/Functional/Api_Stations_MountsCest.php @@ -1,14 +1,18 @@ wantTo('Manage station mount points via API.'); diff --git a/tests/Functional/Api_Stations_PlaylistsCest.php b/tests/Functional/Api_Stations_PlaylistsCest.php index cacea14e4..521fff277 100644 --- a/tests/Functional/Api_Stations_PlaylistsCest.php +++ b/tests/Functional/Api_Stations_PlaylistsCest.php @@ -1,9 +1,12 @@ wantTo('Manage station playlists via API.'); diff --git a/tests/Functional/Api_Stations_PodcastsCest.php b/tests/Functional/Api_Stations_PodcastsCest.php index d876910b5..186ac0051 100644 --- a/tests/Functional/Api_Stations_PodcastsCest.php +++ b/tests/Functional/Api_Stations_PodcastsCest.php @@ -1,14 +1,18 @@ wantTo('Manage station podcasts via API.'); diff --git a/tests/Functional/Api_Stations_RemotesCest.php b/tests/Functional/Api_Stations_RemotesCest.php index 350291849..71d3e49eb 100644 --- a/tests/Functional/Api_Stations_RemotesCest.php +++ b/tests/Functional/Api_Stations_RemotesCest.php @@ -1,8 +1,11 @@ wantTo('Manage station remote relays via API.'); diff --git a/tests/Functional/Api_Stations_ReportsCest.php b/tests/Functional/Api_Stations_ReportsCest.php index 2c6f0628c..a772315c1 100644 --- a/tests/Functional/Api_Stations_ReportsCest.php +++ b/tests/Functional/Api_Stations_ReportsCest.php @@ -1,8 +1,13 @@ wantTo('View various station reports via API.'); @@ -40,23 +45,23 @@ class Api_Stations_ReportsCest extends CestAbstract * @before setupComplete * @before login */ - public function downloadListenerReportsCsv(\FunctionalTester $I): void + public function downloadListenerReportsCsv(FunctionalTester $I): void { $I->wantTo('Download station listener report CSV via API.'); $station = $this->getTestStation(); $uriBase = '/api/station/' . $station->getId(); - $startDateTime = (new \DateTime())->sub(\DateInterval::createFromDateString('30 days')); - $endDateTime = new \DateTime(); + $startDateTime = (new DateTime())->sub(DateInterval::createFromDateString('30 days')); + $endDateTime = new DateTime(); $requestUrl = $uriBase . '/listeners?' . http_build_query( - [ + [ 'format' => 'csv', 'start' => $startDateTime->format('Y-m-d\TH:i:s.v\Z'), 'end' => $endDateTime->format('Y-m-d\TH:i:s.v\Z'), ] - ); + ); $csvHeaders = [ 'IP', @@ -87,23 +92,23 @@ class Api_Stations_ReportsCest extends CestAbstract * @before setupComplete * @before login */ - public function downloadHistoryReportCsv(\FunctionalTester $I): void + public function downloadHistoryReportCsv(FunctionalTester $I): void { $I->wantTo('Download station timeline report CSV via API.'); $station = $this->getTestStation(); $uriBase = '/api/station/' . $station->getId(); - $startDateTime = (new \DateTime())->sub(\DateInterval::createFromDateString('30 days')); - $endDateTime = new \DateTime(); + $startDateTime = (new DateTime())->sub(DateInterval::createFromDateString('30 days')); + $endDateTime = new DateTime(); $requestUrl = $uriBase . '/history?' . http_build_query( - [ + [ 'format' => 'csv', 'start' => $startDateTime->format('Y-m-d\TH:i:s.v\Z'), 'end' => $endDateTime->format('Y-m-d\TH:i:s.v\Z'), ] - ); + ); $csvHeaders = [ 'Date', @@ -120,7 +125,7 @@ class Api_Stations_ReportsCest extends CestAbstract } protected function testReportCsv( - \FunctionalTester $I, + FunctionalTester $I, string $url, array $headerFields ): void { diff --git a/tests/Functional/Api_Stations_StreamersCest.php b/tests/Functional/Api_Stations_StreamersCest.php index 49ca9091b..0447974d8 100644 --- a/tests/Functional/Api_Stations_StreamersCest.php +++ b/tests/Functional/Api_Stations_StreamersCest.php @@ -1,14 +1,18 @@ wantTo('Manage station streamers via API.'); diff --git a/tests/Functional/Api_Stations_WebhooksCest.php b/tests/Functional/Api_Stations_WebhooksCest.php index 1b614aec9..d9f4319a8 100644 --- a/tests/Functional/Api_Stations_WebhooksCest.php +++ b/tests/Functional/Api_Stations_WebhooksCest.php @@ -1,8 +1,11 @@ wantTo('Manage station webhooks via API.'); diff --git a/tests/Functional/CestAbstract.php b/tests/Functional/CestAbstract.php index 8f5bf3f6a..c85868ed2 100644 --- a/tests/Functional/CestAbstract.php +++ b/tests/Functional/CestAbstract.php @@ -1,17 +1,29 @@ environment = $this->di->get(Environment::class); } - public function _after(\FunctionalTester $I): void + public function _after(FunctionalTester $I): void { $this->em->clear(); @@ -53,7 +65,7 @@ abstract class CestAbstract } } - protected function setupIncomplete(\FunctionalTester $I): void + protected function setupIncomplete(FunctionalTester $I): void { $I->wantTo('Start with an incomplete setup.'); @@ -65,7 +77,7 @@ abstract class CestAbstract $this->settingsRepo->writeSettings($settings); } - protected function setupComplete(\FunctionalTester $I): void + protected function setupComplete(FunctionalTester $I): void { $this->_cleanTables(); @@ -76,19 +88,19 @@ abstract class CestAbstract $this->setupCompleteSettings($I); } - protected function setupCompleteUser(\FunctionalTester $I): void + protected function setupCompleteUser(FunctionalTester $I): void { // Create administrator account. - $role = new \App\Entity\Role; + $role = new Role(); $role->setName('Super Administrator'); $this->em->persist($role); - $rha = new \App\Entity\RolePermission($role); + $rha = new RolePermission($role); $rha->setActionName(GlobalPermissions::All); $this->em->persist($rha); // Create user account. - $user = new \App\Entity\User; + $user = new User(); $user->setName('AzuraCast Test User'); $user->setEmail($this->login_username); $user->setNewPassword($this->login_password); @@ -100,7 +112,7 @@ abstract class CestAbstract // Create API key $key = SplitToken::generate(); - $apiKey = new \App\Entity\ApiKey($user, $key); + $apiKey = new ApiKey($user, $key); $apiKey->setComment('Test Suite'); $this->em->persist($apiKey); @@ -112,7 +124,7 @@ abstract class CestAbstract $this->di->get(Acl::class)->reload(); } - protected function setupCompleteStations(\FunctionalTester $I): void + protected function setupCompleteStations(FunctionalTester $I): void { $I->sendPost( '/api/admin/stations', @@ -123,34 +135,34 @@ abstract class CestAbstract ); $stationId = $I->grabDataFromResponseByJsonPath('id'); - $this->test_station = $this->em->find(\App\Entity\Station::class, $stationId[0]); + $this->test_station = $this->em->find(Station::class, $stationId[0]); } - protected function setupCompleteSettings(\FunctionalTester $I): void + protected function setupCompleteSettings(FunctionalTester $I): void { $I->sendPut( - '/api/admin/settings/' . \App\Entity\Settings::GROUP_GENERAL, + '/api/admin/settings/' . Settings::GROUP_GENERAL, [ 'base_url' => 'http://localhost', ] ); } - protected function getTestStation(): \App\Entity\Station + protected function getTestStation(): Station { - if ($this->test_station instanceof \App\Entity\Station) { + if ($this->test_station instanceof Station) { $testStation = $this->em->refetch($this->test_station); - if ($testStation instanceof \App\Entity\Station) { + if ($testStation instanceof Station) { return $testStation; } $this->test_station = null; } - throw new \RuntimeException('Test station is not established.'); + throw new RuntimeException('Test station is not established.'); } - protected function uploadTestSong(): \App\Entity\StationMedia + protected function uploadTestSong(): StationMedia { $testStation = $this->getTestStation(); @@ -158,9 +170,9 @@ abstract class CestAbstract $storageLocation = $testStation->getMediaStorageLocation(); - $storageLocationRepo = $this->di->get(\App\Entity\Repository\StorageLocationRepository::class); + $storageLocationRepo = $this->di->get(StorageLocationRepository::class); $storageFs = $storageLocationRepo->getAdapter($storageLocation)->getFilesystem(); - + $storageFs->upload($songSrc, 'test.mp3'); /** @var MediaProcessor $mediaProcessor */ @@ -172,10 +184,10 @@ abstract class CestAbstract protected function _cleanTables(): void { $cleanTables = [ - \App\Entity\User::class, - \App\Entity\Role::class, - \App\Entity\Station::class, - \App\Entity\Settings::class, + User::class, + Role::class, + Station::class, + Settings::class, ]; foreach ($cleanTables as $cleanTable) { @@ -185,7 +197,7 @@ abstract class CestAbstract $this->em->clear(); } - protected function login(\FunctionalTester $I): void + protected function login(FunctionalTester $I): void { $this->setupComplete($I); @@ -204,7 +216,7 @@ abstract class CestAbstract } protected function testCrudApi( - \FunctionalTester $I, + FunctionalTester $I, string $listUrl, array $createJson = [], array $editJson = [] diff --git a/tests/Functional/Frontend_ErrorCest.php b/tests/Functional/Frontend_ErrorCest.php index 66f0b2660..84f6e55a3 100644 --- a/tests/Functional/Frontend_ErrorCest.php +++ b/tests/Functional/Frontend_ErrorCest.php @@ -1,10 +1,14 @@ wantTo('Verify error code pages.'); diff --git a/tests/Functional/Frontend_IndexCest.php b/tests/Functional/Frontend_IndexCest.php index cacfdac94..af961a109 100644 --- a/tests/Functional/Frontend_IndexCest.php +++ b/tests/Functional/Frontend_IndexCest.php @@ -1,14 +1,18 @@ wantTo('See the proper data on the homepage.'); diff --git a/tests/Functional/Frontend_PublicCest.php b/tests/Functional/Frontend_PublicCest.php index d5cb8bd87..48888985a 100644 --- a/tests/Functional/Frontend_PublicCest.php +++ b/tests/Functional/Frontend_PublicCest.php @@ -1,13 +1,17 @@ wantTo('Verify that the public page displays.'); diff --git a/tests/Functional/Frontend_SetupCest.php b/tests/Functional/Frontend_SetupCest.php index fbdfc6419..f750f6afb 100644 --- a/tests/Functional/Frontend_SetupCest.php +++ b/tests/Functional/Frontend_SetupCest.php @@ -1,7 +1,11 @@ wantTo('Complete the initial setup process.'); @@ -22,7 +26,7 @@ class Frontend_SetupCest extends CestAbstract $I->comment('Setup redirect found.'); } - protected function setupRegister(\FunctionalTester $I): void + protected function setupRegister(FunctionalTester $I): void { $I->amOnPage('/setup'); @@ -42,7 +46,7 @@ class Frontend_SetupCest extends CestAbstract ); } - protected function setupStation(\FunctionalTester $I): void + protected function setupStation(FunctionalTester $I): void { $I->amOnPage('/setup'); $I->seeCurrentUrlEquals('/setup/station'); @@ -51,7 +55,7 @@ class Frontend_SetupCest extends CestAbstract $this->setupCompleteStations($I); } - protected function setupSettings(\FunctionalTester $I): void + protected function setupSettings(FunctionalTester $I): void { $I->amOnPage('/setup'); $I->seeCurrentUrlEquals('/setup/settings'); diff --git a/tests/Functional/Station_MediaCest.php b/tests/Functional/Station_MediaCest.php index ba5d1fd20..666fcc75d 100644 --- a/tests/Functional/Station_MediaCest.php +++ b/tests/Functional/Station_MediaCest.php @@ -1,14 +1,18 @@ wantTo('Upload a song to a station.'); diff --git a/tests/Functional/Station_MountPointsCest.php b/tests/Functional/Station_MountPointsCest.php index e883f5ed9..e8515c9c8 100644 --- a/tests/Functional/Station_MountPointsCest.php +++ b/tests/Functional/Station_MountPointsCest.php @@ -1,14 +1,18 @@ getTestStation(); $stationId = $testStation->getId(); diff --git a/tests/Functional/Station_PlaylistsCest.php b/tests/Functional/Station_PlaylistsCest.php index 74400f6d4..fd0b3165c 100644 --- a/tests/Functional/Station_PlaylistsCest.php +++ b/tests/Functional/Station_PlaylistsCest.php @@ -1,14 +1,18 @@ wantTo('Create a station playlist.'); diff --git a/tests/Functional/Station_ProfileCest.php b/tests/Functional/Station_ProfileCest.php index 84933533a..1bfdcfb98 100644 --- a/tests/Functional/Station_ProfileCest.php +++ b/tests/Functional/Station_ProfileCest.php @@ -1,14 +1,18 @@ wantTo('View and edit a station profile.'); diff --git a/tests/Functional/Station_RemoteRelaysCest.php b/tests/Functional/Station_RemoteRelaysCest.php index da6e35eff..1ccfde890 100644 --- a/tests/Functional/Station_RemoteRelaysCest.php +++ b/tests/Functional/Station_RemoteRelaysCest.php @@ -1,14 +1,18 @@ getTestStation(); $stationId = $testStation->getId(); diff --git a/tests/Functional/Station_ReportsCest.php b/tests/Functional/Station_ReportsCest.php index 0feccf8a8..66534cd50 100644 --- a/tests/Functional/Station_ReportsCest.php +++ b/tests/Functional/Station_ReportsCest.php @@ -1,14 +1,18 @@ wantTo('View station reports.'); diff --git a/tests/Functional/_bootstrap.php b/tests/Functional/_bootstrap.php index ffcc9e0b3..a4ac4afa2 100644 --- a/tests/Functional/_bootstrap.php +++ b/tests/Functional/_bootstrap.php @@ -1,2 +1,5 @@ setName('Test Playlist'); // Sample playlist that plays from 10PM to 4AM the next day. - $scheduleEntry = new \App\Entity\StationSchedule($playlist); + $scheduleEntry = new StationSchedule($playlist); $scheduleEntry->setStartTime(2200); $scheduleEntry->setEndTime(400); $scheduleEntry->setDays([1, 2, 3]); // Monday, Tuesday, Wednesday @@ -65,12 +71,12 @@ class StationPlaylistTest extends Unit public function testOncePerXMinutesPlaylist() { - /** @var \App\Entity\Station $station */ - $station = Mockery::mock(\App\Entity\Station::class); + /** @var Station $station */ + $station = Mockery::mock(Station::class); - $playlist = new \App\Entity\StationPlaylist($station); + $playlist = new StationPlaylist($station); $playlist->setName('Test Playlist'); - $playlist->setType(\App\Entity\Enums\PlaylistTypes::OncePerXMinutes); + $playlist->setType(PlaylistTypes::OncePerXMinutes); $playlist->setPlayPerMinutes(30); $utc = new DateTimeZone('UTC'); @@ -91,12 +97,12 @@ class StationPlaylistTest extends Unit public function testOncePerHourPlaylist() { - /** @var \App\Entity\Station $station */ - $station = Mockery::mock(\App\Entity\Station::class); + /** @var Station $station */ + $station = Mockery::mock(Station::class); - $playlist = new \App\Entity\StationPlaylist($station); + $playlist = new StationPlaylist($station); $playlist->setName('Test Playlist'); - $playlist->setType(\App\Entity\Enums\PlaylistTypes::OncePerHour); + $playlist->setType(PlaylistTypes::OncePerHour); $playlist->setPlayPerHourMinute(50); $utc = new DateTimeZone('UTC'); diff --git a/tests/Unit/UtilitiesTest.php b/tests/Unit/UtilitiesTest.php index 8a7e4d0ff..6d3ea5bf0 100644 --- a/tests/Unit/UtilitiesTest.php +++ b/tests/Unit/UtilitiesTest.php @@ -1,5 +1,7 @@