diff --git a/codeception.yml b/codeception.yml index 6f6e33ee4..f5a5a10ad 100644 --- a/codeception.yml +++ b/codeception.yml @@ -1,7 +1,7 @@ actor: Tester paths: tests: tests - log: tests/_output + output: tests/_output data: tests/_data support: tests/_support envs: tests/_envs @@ -11,9 +11,6 @@ settings: colors: true memory_limit: 1024M error_level: "E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED" -extensions: - enabled: - - Codeception\Extension\RunFailed modules: coverage : enabled : true @@ -37,4 +34,4 @@ coverage : # Exceptions - src/Exception/*.php - - src/Mvc/ErrorHandler.php + - src/Http/ErrorHandler.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2c7821f49..7e29b0f73 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Parameter \\#2 \\$record of method App\\\\Controller\\\\Api\\\\AbstractApiCrudController\\\\:\\:fromArray\\(\\) expects \\(TEntity of App\\\\Entity\\\\StationPlaylist\\|App\\\\Entity\\\\StationStreamer\\)\\|null, \\(TEntity of App\\\\Entity\\\\StationPlaylist\\|App\\\\Entity\\\\StationStreamer\\)\\|null given\\.$#" - count: 1 - path: src/Controller/Api/Stations/AbstractScheduledEntityController.php - - message: "#^Parameter \\#3 \\$criteria of method Doctrine\\\\DBAL\\\\Connection\\:\\:update\\(\\) expects array\\, array\\ given\\.$#" count: 1 diff --git a/src/Tests/Module.php b/src/Tests/Module.php index 017b60071..c3427ba88 100644 --- a/src/Tests/Module.php +++ b/src/Tests/Module.php @@ -29,7 +29,7 @@ class Module extends Framework implements DoctrineProvider public ReloadableEntityManagerInterface $em; - public function __construct(ModuleContainer $moduleContainer, $config = null) + public function __construct(ModuleContainer $moduleContainer, ?array $config = null) { parent::__construct($moduleContainer, $config); diff --git a/src/Utilities/Strings.php b/src/Utilities/Strings.php index bf0067914..651440ec0 100644 --- a/src/Utilities/Strings.php +++ b/src/Utilities/Strings.php @@ -51,7 +51,8 @@ class Strings $max = mb_strlen($keyspace, '8bit') - 1; for ($i = 0; $i < $length; ++$i) { - $str .= $keyspace[random_int(0, $max)]; + /** @noinspection RandomApiMigrationInspection */ + $str .= $keyspace[rand(0, $max)]; } return $str; } diff --git a/tests/Functional.suite.yml b/tests/Functional.suite.yml new file mode 100644 index 000000000..f49e11819 --- /dev/null +++ b/tests/Functional.suite.yml @@ -0,0 +1,11 @@ +actor: FunctionalTester +suite_namespace: \Functional +modules: + enabled: + - \App\Tests\Module: + container: \App\AppFactory + - Doctrine2: + depends: \App\Tests\Module + - REST: + depends: \App\Tests\Module + - Cli diff --git a/tests/functional/Admin_DebugCest.php b/tests/Functional/Admin_DebugCest.php similarity index 78% rename from tests/functional/Admin_DebugCest.php rename to tests/Functional/Admin_DebugCest.php index f1710eafe..fc1261b8f 100644 --- a/tests/functional/Admin_DebugCest.php +++ b/tests/Functional/Admin_DebugCest.php @@ -1,12 +1,14 @@ 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 similarity index 77% rename from tests/functional/Admin_IndexCest.php rename to tests/Functional/Admin_IndexCest.php index b4db14190..4960ce43a 100644 --- a/tests/functional/Admin_IndexCest.php +++ b/tests/Functional/Admin_IndexCest.php @@ -1,12 +1,14 @@ wantTo('See the administration homepage.'); diff --git a/tests/functional/Admin_RecordsCest.php b/tests/Functional/Admin_RecordsCest.php similarity index 90% rename from tests/functional/Admin_RecordsCest.php rename to tests/Functional/Admin_RecordsCest.php index 67b13d867..788d5eb40 100644 --- a/tests/functional/Admin_RecordsCest.php +++ b/tests/Functional/Admin_RecordsCest.php @@ -1,12 +1,14 @@ wantTo('Manage users.'); @@ -50,7 +52,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.'); @@ -77,7 +79,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 similarity index 76% rename from tests/functional/Api_Admin_AuditLogCest.php rename to tests/Functional/Api_Admin_AuditLogCest.php index d8562d514..9a718d4f6 100644 --- a/tests/functional/Api_Admin_AuditLogCest.php +++ b/tests/Functional/Api_Admin_AuditLogCest.php @@ -1,12 +1,14 @@ wantTo('View audit log via API.'); diff --git a/tests/functional/Api_Admin_CustomFieldsCest.php b/tests/Functional/Api_Admin_CustomFieldsCest.php similarity index 82% rename from tests/functional/Api_Admin_CustomFieldsCest.php rename to tests/Functional/Api_Admin_CustomFieldsCest.php index 67d3c7e60..c9e7ecc93 100644 --- a/tests/functional/Api_Admin_CustomFieldsCest.php +++ b/tests/Functional/Api_Admin_CustomFieldsCest.php @@ -1,12 +1,14 @@ wantTo('Manage custom fields via API.'); diff --git a/tests/functional/Api_Admin_RolesCest.php b/tests/Functional/Api_Admin_RolesCest.php similarity index 74% rename from tests/functional/Api_Admin_RolesCest.php rename to tests/Functional/Api_Admin_RolesCest.php index a02e1515c..6af4c015d 100644 --- a/tests/functional/Api_Admin_RolesCest.php +++ b/tests/Functional/Api_Admin_RolesCest.php @@ -1,12 +1,17 @@ wantTo('Manage roles via API.'); @@ -17,7 +22,7 @@ class Api_Admin_RolesCest extends CestAbstract 'name' => 'Generic Admin', 'permissions' => [ 'global' => [ - App\Enums\GlobalPermissions::All->value, + GlobalPermissions::All->value, ], ], ], @@ -27,11 +32,11 @@ 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.'); - $permissionRepo = $this->di->get(App\Entity\Repository\RolePermissionRepository::class); + $permissionRepo = $this->di->get(RolePermissionRepository::class); $superAdminRole = $permissionRepo->ensureSuperAdministratorRole(); $I->sendPut( diff --git a/tests/functional/Api_Admin_StationsCest.php b/tests/Functional/Api_Admin_StationsCest.php similarity index 57% rename from tests/functional/Api_Admin_StationsCest.php rename to tests/Functional/Api_Admin_StationsCest.php index 117182ede..139cb3a89 100644 --- a/tests/functional/Api_Admin_StationsCest.php +++ b/tests/Functional/Api_Admin_StationsCest.php @@ -1,12 +1,16 @@ wantTo('Manage stations via API.'); @@ -14,12 +18,12 @@ class Api_Admin_StationsCest extends CestAbstract $I, '/api/admin/stations', [ - 'name' => 'Test Station', + 'name' => 'Test Station', 'short_name' => 'test_station', ], [ - 'name' => 'Modified Station', - 'frontend_type' => \App\Radio\Enums\FrontendAdapters::Shoutcast->value, + 'name' => 'Modified Station', + 'frontend_type' => FrontendAdapters::Shoutcast->value, ] ); } diff --git a/tests/functional/Api_Admin_StorageLocationsCest.php b/tests/Functional/Api_Admin_StorageLocationsCest.php similarity index 52% rename from tests/functional/Api_Admin_StorageLocationsCest.php rename to tests/Functional/Api_Admin_StorageLocationsCest.php index 491a97565..292624e22 100644 --- a/tests/functional/Api_Admin_StorageLocationsCest.php +++ b/tests/Functional/Api_Admin_StorageLocationsCest.php @@ -1,12 +1,17 @@ wantTo('Manage storage locations via API.'); @@ -14,9 +19,9 @@ class Api_Admin_StorageLocationsCest extends CestAbstract $I, '/api/admin/storage_locations', [ - 'type' => App\Entity\Enums\StorageLocationTypes::StationMedia->value, - 'adapter' => App\Entity\Enums\StorageLocationAdapters::Local->value, - 'path' => '/tmp/test_storage_location', + 'type' => StorageLocationTypes::StationMedia->value, + 'adapter' => StorageLocationAdapters::Local->value, + 'path' => '/tmp/test_storage_location', ], [ 'path' => '/tmp/test_storage_location_2', diff --git a/tests/functional/Api_Admin_UsersCest.php b/tests/Functional/Api_Admin_UsersCest.php similarity index 84% rename from tests/functional/Api_Admin_UsersCest.php rename to tests/Functional/Api_Admin_UsersCest.php index c8b6e1ab6..7d4f0b340 100644 --- a/tests/functional/Api_Admin_UsersCest.php +++ b/tests/Functional/Api_Admin_UsersCest.php @@ -1,12 +1,14 @@ wantTo('Manage users via API.'); diff --git a/tests/functional/Api_Frontend_AccountCest.php b/tests/Functional/Api_Frontend_AccountCest.php similarity index 96% rename from tests/functional/Api_Frontend_AccountCest.php rename to tests/Functional/Api_Frontend_AccountCest.php index c4bc2da7a..91e34df77 100644 --- a/tests/functional/Api_Frontend_AccountCest.php +++ b/tests/Functional/Api_Frontend_AccountCest.php @@ -1,12 +1,14 @@ wantTo('Check frontend account API functions.'); diff --git a/tests/functional/Api_Frontend_DashboardCest.php b/tests/Functional/Api_Frontend_DashboardCest.php similarity index 87% rename from tests/functional/Api_Frontend_DashboardCest.php rename to tests/Functional/Api_Frontend_DashboardCest.php index fd378dcb3..a29c51246 100644 --- a/tests/functional/Api_Frontend_DashboardCest.php +++ b/tests/Functional/Api_Frontend_DashboardCest.php @@ -1,12 +1,14 @@ wantTo('Check dashboard API functions.'); diff --git a/tests/functional/Api_IndexCest.php b/tests/Functional/Api_IndexCest.php similarity index 68% rename from tests/functional/Api_IndexCest.php rename to tests/Functional/Api_IndexCest.php index d77adedee..7e222fc44 100644 --- a/tests/functional/Api_IndexCest.php +++ b/tests/Functional/Api_IndexCest.php @@ -1,19 +1,22 @@ wantTo('Check basic API functions.'); $I->sendGET('/api/status'); $I->seeResponseContainsJson( [ - 'online' => true, - ]); + 'online' => true, + ] + ); $I->sendGET('/api/time'); $I->seeResponseCodeIs(200); diff --git a/tests/functional/Api_RequestsCest.php b/tests/Functional/Api_RequestsCest.php similarity index 92% rename from tests/functional/Api_RequestsCest.php rename to tests/Functional/Api_RequestsCest.php index bad765826..53618c8bd 100644 --- a/tests/functional/Api_RequestsCest.php +++ b/tests/Functional/Api_RequestsCest.php @@ -1,5 +1,7 @@ wantTo('Check request API endpoints.'); diff --git a/tests/functional/Api_StationsCest.php b/tests/Functional/Api_StationsCest.php similarity index 86% rename from tests/functional/Api_StationsCest.php rename to tests/Functional/Api_StationsCest.php index 8310f624d..5ca79444d 100644 --- a/tests/functional/Api_StationsCest.php +++ b/tests/Functional/Api_StationsCest.php @@ -1,11 +1,13 @@ wantTo('Check station API endpoints.'); diff --git a/tests/functional/Api_Stations_MountsCest.php b/tests/Functional/Api_Stations_MountsCest.php similarity index 88% rename from tests/functional/Api_Stations_MountsCest.php rename to tests/Functional/Api_Stations_MountsCest.php index 0f1a1c275..79811f2a7 100644 --- a/tests/functional/Api_Stations_MountsCest.php +++ b/tests/Functional/Api_Stations_MountsCest.php @@ -1,12 +1,14 @@ wantTo('Manage station mount points via API.'); diff --git a/tests/functional/Api_Stations_PlaylistsCest.php b/tests/Functional/Api_Stations_PlaylistsCest.php similarity index 56% rename from tests/functional/Api_Stations_PlaylistsCest.php rename to tests/Functional/Api_Stations_PlaylistsCest.php index a185f5219..cacea14e4 100644 --- a/tests/functional/Api_Stations_PlaylistsCest.php +++ b/tests/Functional/Api_Stations_PlaylistsCest.php @@ -1,12 +1,17 @@ wantTo('Manage station playlists via API.'); @@ -16,14 +21,14 @@ class Api_Stations_PlaylistsCest extends CestAbstract $I, '/api/station/' . $station->getId() . '/playlists', [ - 'name' => 'General Rotation Playlist', - 'source' => App\Entity\Enums\PlaylistSources::Songs->value, - 'type' => App\Entity\Enums\PlaylistTypes::Standard->value, + 'name' => 'General Rotation Playlist', + 'source' => PlaylistSources::Songs->value, + 'type' => PlaylistTypes::Standard->value, 'weight' => 5, ], [ 'name' => 'Modified Playlist', - 'type' => App\Entity\Enums\PlaylistTypes::Advanced->value, + 'type' => PlaylistTypes::Advanced->value, ] ); } diff --git a/tests/functional/Api_Stations_PodcastsCest.php b/tests/Functional/Api_Stations_PodcastsCest.php similarity index 95% rename from tests/functional/Api_Stations_PodcastsCest.php rename to tests/Functional/Api_Stations_PodcastsCest.php index 74be93e38..d876910b5 100644 --- a/tests/functional/Api_Stations_PodcastsCest.php +++ b/tests/Functional/Api_Stations_PodcastsCest.php @@ -1,12 +1,14 @@ wantTo('Manage station podcasts via API.'); diff --git a/tests/functional/Api_Stations_RemotesCest.php b/tests/Functional/Api_Stations_RemotesCest.php similarity index 74% rename from tests/functional/Api_Stations_RemotesCest.php rename to tests/Functional/Api_Stations_RemotesCest.php index 47bd484cd..350291849 100644 --- a/tests/functional/Api_Stations_RemotesCest.php +++ b/tests/Functional/Api_Stations_RemotesCest.php @@ -1,12 +1,16 @@ wantTo('Manage station remote relays via API.'); @@ -16,7 +20,7 @@ class Api_Stations_RemotesCest extends CestAbstract $I, '/api/station/' . $station->getId() . '/remotes', [ - 'type' => \App\Radio\Enums\RemoteAdapters::Icecast->value, + 'type' => RemoteAdapters::Icecast->value, 'display_name' => 'Test Remote Relay', ], [ diff --git a/tests/functional/Api_Stations_ReportsCest.php b/tests/Functional/Api_Stations_ReportsCest.php similarity index 88% rename from tests/functional/Api_Stations_ReportsCest.php rename to tests/Functional/Api_Stations_ReportsCest.php index ff875b0f0..e6d1a72c0 100644 --- a/tests/functional/Api_Stations_ReportsCest.php +++ b/tests/Functional/Api_Stations_ReportsCest.php @@ -1,12 +1,14 @@ wantTo('View various station reports via API.'); diff --git a/tests/functional/Api_Stations_StreamersCest.php b/tests/Functional/Api_Stations_StreamersCest.php similarity index 94% rename from tests/functional/Api_Stations_StreamersCest.php rename to tests/Functional/Api_Stations_StreamersCest.php index 04b15dc64..b00d69c7c 100644 --- a/tests/functional/Api_Stations_StreamersCest.php +++ b/tests/Functional/Api_Stations_StreamersCest.php @@ -1,12 +1,14 @@ wantTo('Manage station streamers via API.'); diff --git a/tests/functional/Api_Stations_WebhooksCest.php b/tests/Functional/Api_Stations_WebhooksCest.php similarity index 86% rename from tests/functional/Api_Stations_WebhooksCest.php rename to tests/Functional/Api_Stations_WebhooksCest.php index 7fc5dd67a..44c168095 100644 --- a/tests/functional/Api_Stations_WebhooksCest.php +++ b/tests/Functional/Api_Stations_WebhooksCest.php @@ -1,12 +1,14 @@ wantTo('Manage station webhooks via API.'); diff --git a/tests/functional/CestAbstract.php b/tests/Functional/CestAbstract.php similarity index 85% rename from tests/functional/CestAbstract.php rename to tests/Functional/CestAbstract.php index 1caaa70ed..a21a22dc0 100644 --- a/tests/functional/CestAbstract.php +++ b/tests/Functional/CestAbstract.php @@ -1,15 +1,21 @@ di = $tests_module->container; $this->em = $tests_module->em; $this->settingsRepo = $this->di->get(Entity\Repository\SettingsRepository::class); $this->stationRepo = $this->di->get(Entity\Repository\StationRepository::class); - $this->environment = $this->di->get(App\Environment::class); + $this->environment = $this->di->get(Environment::class); } - public function _after(FunctionalTester $I): void + public function _after(\FunctionalTester $I): void { $this->em->clear(); @@ -45,7 +51,7 @@ abstract class CestAbstract } } - protected function setupIncomplete(FunctionalTester $I): void + protected function setupIncomplete(\FunctionalTester $I): void { $I->wantTo('Start with an incomplete setup.'); @@ -57,7 +63,7 @@ abstract class CestAbstract $this->settingsRepo->writeSettings($settings); } - protected function setupComplete(FunctionalTester $I): void + protected function setupComplete(\FunctionalTester $I): void { $this->_cleanTables(); @@ -68,7 +74,7 @@ abstract class CestAbstract $this->setupCompleteSettings($I); } - protected function setupCompleteUser(FunctionalTester $I): void + protected function setupCompleteUser(\FunctionalTester $I): void { // Create administrator account. $role = new Entity\Role; @@ -76,7 +82,7 @@ abstract class CestAbstract $this->em->persist($role); $rha = new Entity\RolePermission($role); - $rha->setActionName(App\Enums\GlobalPermissions::All); + $rha->setActionName(GlobalPermissions::All); $this->em->persist($rha); // Create user account. @@ -101,10 +107,10 @@ abstract class CestAbstract $this->login_api_key = (string)$key; $I->amBearerAuthenticated($this->login_api_key); - $this->di->get(App\Acl::class)->reload(); + $this->di->get(Acl::class)->reload(); } - protected function setupCompleteStations(FunctionalTester $I): void + protected function setupCompleteStations(\FunctionalTester $I): void { $I->sendPost( '/api/admin/stations', @@ -118,7 +124,7 @@ abstract class CestAbstract $this->test_station = $this->em->find(Entity\Station::class, $stationId[0]); } - protected function setupCompleteSettings(FunctionalTester $I): void + protected function setupCompleteSettings(\FunctionalTester $I): void { $I->sendPut( '/api/admin/settings/' . Entity\Settings::GROUP_GENERAL, @@ -139,7 +145,7 @@ abstract class CestAbstract $this->test_station = null; } - throw new RuntimeException('Test station is not established.'); + throw new \RuntimeException('Test station is not established.'); } protected function uploadTestSong(): Entity\StationMedia @@ -175,7 +181,7 @@ abstract class CestAbstract $this->em->clear(); } - protected function login(FunctionalTester $I): void + protected function login(\FunctionalTester $I): void { $this->setupComplete($I); @@ -194,7 +200,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 similarity index 71% rename from tests/functional/Frontend_ErrorCest.php rename to tests/Functional/Frontend_ErrorCest.php index 01a7b40b2..66f0b2660 100644 --- a/tests/functional/Frontend_ErrorCest.php +++ b/tests/Functional/Frontend_ErrorCest.php @@ -1,8 +1,10 @@ wantTo('Verify error code pages.'); diff --git a/tests/functional/Frontend_IndexCest.php b/tests/Functional/Frontend_IndexCest.php similarity index 76% rename from tests/functional/Frontend_IndexCest.php rename to tests/Functional/Frontend_IndexCest.php index ef180d697..cacfdac94 100644 --- a/tests/functional/Frontend_IndexCest.php +++ b/tests/Functional/Frontend_IndexCest.php @@ -1,12 +1,14 @@ wantTo('See the proper data on the homepage.'); diff --git a/tests/functional/Frontend_PublicCest.php b/tests/Functional/Frontend_PublicCest.php similarity index 95% rename from tests/functional/Frontend_PublicCest.php rename to tests/Functional/Frontend_PublicCest.php index 098d9c35a..d5cb8bd87 100644 --- a/tests/functional/Frontend_PublicCest.php +++ b/tests/Functional/Frontend_PublicCest.php @@ -1,11 +1,13 @@ wantTo('Verify that the public page displays.'); diff --git a/tests/functional/Frontend_SetupCest.php b/tests/Functional/Frontend_SetupCest.php similarity index 82% rename from tests/functional/Frontend_SetupCest.php rename to tests/Functional/Frontend_SetupCest.php index 3a2d53d65..fbdfc6419 100644 --- a/tests/functional/Frontend_SetupCest.php +++ b/tests/Functional/Frontend_SetupCest.php @@ -1,5 +1,7 @@ wantTo('Complete the initial setup process.'); @@ -20,7 +22,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'); @@ -40,7 +42,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'); @@ -49,7 +51,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 similarity index 93% rename from tests/functional/Station_MediaCest.php rename to tests/Functional/Station_MediaCest.php index 44a529f84..b026db46b 100644 --- a/tests/functional/Station_MediaCest.php +++ b/tests/Functional/Station_MediaCest.php @@ -1,12 +1,14 @@ wantTo('Upload a song to a station.'); diff --git a/tests/functional/Station_MountPointsCest.php b/tests/Functional/Station_MountPointsCest.php similarity index 79% rename from tests/functional/Station_MountPointsCest.php rename to tests/Functional/Station_MountPointsCest.php index 26ccbdb89..b0e54c2c3 100644 --- a/tests/functional/Station_MountPointsCest.php +++ b/tests/Functional/Station_MountPointsCest.php @@ -1,12 +1,14 @@ getTestStation(); $station_id = $testStation->getId(); diff --git a/tests/functional/Station_PlaylistsCest.php b/tests/Functional/Station_PlaylistsCest.php similarity index 81% rename from tests/functional/Station_PlaylistsCest.php rename to tests/Functional/Station_PlaylistsCest.php index 06206e42e..f3f7645aa 100644 --- a/tests/functional/Station_PlaylistsCest.php +++ b/tests/Functional/Station_PlaylistsCest.php @@ -1,12 +1,14 @@ wantTo('Create a station playlist.'); diff --git a/tests/functional/Station_ProfileCest.php b/tests/Functional/Station_ProfileCest.php similarity index 90% rename from tests/functional/Station_ProfileCest.php rename to tests/Functional/Station_ProfileCest.php index c2b5a97e6..79d892611 100644 --- a/tests/functional/Station_ProfileCest.php +++ b/tests/Functional/Station_ProfileCest.php @@ -1,12 +1,14 @@ wantTo('View and edit a station profile.'); diff --git a/tests/functional/Station_RemoteRelaysCest.php b/tests/Functional/Station_RemoteRelaysCest.php similarity index 79% rename from tests/functional/Station_RemoteRelaysCest.php rename to tests/Functional/Station_RemoteRelaysCest.php index e9043ae88..86f57eb3b 100644 --- a/tests/functional/Station_RemoteRelaysCest.php +++ b/tests/Functional/Station_RemoteRelaysCest.php @@ -1,12 +1,14 @@ getTestStation(); $station_id = $testStation->getId(); diff --git a/tests/functional/Station_ReportsCest.php b/tests/Functional/Station_ReportsCest.php similarity index 93% rename from tests/functional/Station_ReportsCest.php rename to tests/Functional/Station_ReportsCest.php index 32412aa48..d8ac26d35 100644 --- a/tests/functional/Station_ReportsCest.php +++ b/tests/Functional/Station_ReportsCest.php @@ -1,12 +1,14 @@ wantTo('View station reports.'); diff --git a/tests/functional/_bootstrap.php b/tests/Functional/_bootstrap.php similarity index 100% rename from tests/functional/_bootstrap.php rename to tests/Functional/_bootstrap.php diff --git a/tests/Unit.suite.yml b/tests/Unit.suite.yml new file mode 100644 index 000000000..e75c29683 --- /dev/null +++ b/tests/Unit.suite.yml @@ -0,0 +1,8 @@ +actor: UnitTester +suite_namespace: \Unit +modules: + enabled: + - \App\Tests\Module: + container: \App\AppFactory + +error_level: "E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED" diff --git a/tests/unit/ExportsTest.php b/tests/Unit/ExportsTest.php similarity index 93% rename from tests/unit/ExportsTest.php rename to tests/Unit/ExportsTest.php index c30717891..2e8f06323 100644 --- a/tests/unit/ExportsTest.php +++ b/tests/Unit/ExportsTest.php @@ -1,10 +1,12 @@ container; - $this->scheduler = $di->get(App\Radio\AutoDJ\Scheduler::class); + $this->scheduler = $di->get(\App\Radio\AutoDJ\Scheduler::class); } public function testScheduledPlaylist(): void { /** @var Entity\Station $station */ - $station = Mockery::mock(Entity\Station::class); + $station = \Mockery::mock(Entity\Station::class); $playlist = new Entity\StationPlaylist($station); $playlist->setName('Test Playlist'); @@ -58,7 +60,7 @@ class StationPlaylistTest extends \Codeception\Test\Unit public function testOncePerXMinutesPlaylist() { /** @var Entity\Station $station */ - $station = Mockery::mock(Entity\Station::class); + $station = \Mockery::mock(Entity\Station::class); $playlist = new Entity\StationPlaylist($station); $playlist->setName('Test Playlist'); @@ -84,7 +86,7 @@ class StationPlaylistTest extends \Codeception\Test\Unit public function testOncePerHourPlaylist() { /** @var Entity\Station $station */ - $station = Mockery::mock(Entity\Station::class); + $station = \Mockery::mock(Entity\Station::class); $playlist = new Entity\StationPlaylist($station); $playlist->setName('Test Playlist'); diff --git a/tests/unit/UtilitiesTest.php b/tests/Unit/UtilitiesTest.php similarity index 93% rename from tests/unit/UtilitiesTest.php rename to tests/Unit/UtilitiesTest.php index a4b3b4e19..f1f1661ac 100644 --- a/tests/unit/UtilitiesTest.php +++ b/tests/Unit/UtilitiesTest.php @@ -1,10 +1,12 @@ addClassMap([ - 'CestAbstract' => __DIR__.'/functional/CestAbstract.php', + 'Functional\CestAbstract' => __DIR__ . '/Functional/CestAbstract.php', ]); \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader([$autoloader, 'loadClass']); diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml deleted file mode 100644 index ca47ac946..000000000 --- a/tests/functional.suite.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Codeception Test Suite Configuration -# -# Suite for functional (integration) tests -# Emulate web requests and make application process them -# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it - -class_name: FunctionalTester -modules: - enabled: - - \App\Tests\Module: - container: \App\AppFactory - - Doctrine2: - depends: \App\Tests\Module - - REST: - depends: \App\Tests\Module - - Cli diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml deleted file mode 100644 index e4b7b083f..000000000 --- a/tests/unit.suite.yml +++ /dev/null @@ -1,8 +0,0 @@ -class_name: UnitTester -modules: - enabled: - - \App\Tests\Module: - container: \App\AppFactory - - \Helper\Unit - -error_level: "E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED" \ No newline at end of file