Update test suites for Codeception 5.x.
This commit is contained in:
parent
f1be6c5381
commit
c17e1e88f5
|
@ -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
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$record of method App\\\\Controller\\\\Api\\\\AbstractApiCrudController\\<TEntity of App\\\\Entity\\\\StationPlaylist\\|App\\\\Entity\\\\StationStreamer\\>\\:\\: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\\<string, mixed\\>, array\\<int, int\\> given\\.$#"
|
||||
count: 1
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Admin_DebugCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function syncTasks(FunctionalTester $I)
|
||||
public function syncTasks(\FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('Test All Synchronized Tasks');
|
||||
$I->amOnPage('/admin/debug/sync/all');
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Admin_IndexCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function seeAdminHomepage(FunctionalTester $I): void
|
||||
public function seeAdminHomepage(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('See the administration homepage.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Admin_RecordsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageUsers(FunctionalTester $I): void
|
||||
public function manageUsers(\FunctionalTester $I): void
|
||||
{
|
||||
$I->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.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Admin_AuditLogCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function viewAuditLog(FunctionalTester $I): void
|
||||
public function viewAuditLog(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('View audit log via API.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Admin_CustomFieldsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageCustomFields(FunctionalTester $I): void
|
||||
public function manageCustomFields(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Manage custom fields via API.');
|
||||
|
|
@ -1,12 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
use App\Entity\Repository\RolePermissionRepository;
|
||||
use App\Enums\GlobalPermissions;
|
||||
|
||||
class Api_Admin_RolesCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageRoles(FunctionalTester $I): void
|
||||
public function manageRoles(\FunctionalTester $I): void
|
||||
{
|
||||
$I->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(
|
|
@ -1,12 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
use App\Radio\Enums\FrontendAdapters;
|
||||
|
||||
class Api_Admin_StationsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageStations(FunctionalTester $I): void
|
||||
public function manageStations(\FunctionalTester $I): void
|
||||
{
|
||||
$I->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,
|
||||
]
|
||||
);
|
||||
}
|
|
@ -1,12 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
use App\Entity\Enums\StorageLocationAdapters;
|
||||
use App\Entity\Enums\StorageLocationTypes;
|
||||
|
||||
class Api_Admin_StorageLocationsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageStorageLocations(FunctionalTester $I): void
|
||||
public function manageStorageLocations(\FunctionalTester $I): void
|
||||
{
|
||||
$I->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',
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Admin_UsersCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageUsers(FunctionalTester $I): void
|
||||
public function manageUsers(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Manage users via API.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Frontend_AccountCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function checkAccount(FunctionalTester $I): void
|
||||
public function checkAccount(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Check frontend account API functions.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Frontend_DashboardCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function checkDashboard(FunctionalTester $I): void
|
||||
public function checkDashboard(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Check dashboard API functions.');
|
||||
|
|
@ -1,19 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_IndexCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
*/
|
||||
public function checkApiIndex(FunctionalTester $I): void
|
||||
public function checkApiIndex(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Check basic API functions.');
|
||||
|
||||
$I->sendGET('/api/status');
|
||||
$I->seeResponseContainsJson(
|
||||
[
|
||||
'online' => true,
|
||||
]);
|
||||
'online' => true,
|
||||
]
|
||||
);
|
||||
|
||||
$I->sendGET('/api/time');
|
||||
$I->seeResponseCodeIs(200);
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
use App\Entity;
|
||||
|
||||
class Api_RequestsCest extends CestAbstract
|
||||
|
@ -7,7 +9,7 @@ class Api_RequestsCest extends CestAbstract
|
|||
/**
|
||||
* @before setupComplete
|
||||
*/
|
||||
public function checkRequestsAPI(FunctionalTester $I): void
|
||||
public function checkRequestsAPI(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Check request API endpoints.');
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_StationsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
*/
|
||||
public function checkApiStation(FunctionalTester $I): void
|
||||
public function checkApiStation(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Check station API endpoints.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Stations_MountsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageMounts(FunctionalTester $I): void
|
||||
public function manageMounts(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Manage station mount points via API.');
|
||||
|
|
@ -1,12 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
use App\Entity\Enums\PlaylistSources;
|
||||
use App\Entity\Enums\PlaylistTypes;
|
||||
|
||||
class Api_Stations_PlaylistsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function managePlaylists(FunctionalTester $I): void
|
||||
public function managePlaylists(\FunctionalTester $I): void
|
||||
{
|
||||
$I->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,
|
||||
]
|
||||
);
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Stations_PodcastsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function managePodcasts(FunctionalTester $I): void
|
||||
public function managePodcasts(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Manage station podcasts via API.');
|
||||
|
|
@ -1,12 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
use App\Radio\Enums\RemoteAdapters;
|
||||
|
||||
class Api_Stations_RemotesCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageRemotes(FunctionalTester $I): void
|
||||
public function manageRemotes(\FunctionalTester $I): void
|
||||
{
|
||||
$I->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',
|
||||
],
|
||||
[
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Stations_ReportsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function viewReports(FunctionalTester $I): void
|
||||
public function viewReports(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('View various station reports via API.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Stations_StreamersCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageStreamers(FunctionalTester $I): void
|
||||
public function manageStreamers(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Manage station streamers via API.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Api_Stations_WebhooksCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function manageWebhooks(FunctionalTester $I): void
|
||||
public function manageWebhooks(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Manage station webhooks via API.');
|
||||
|
|
@ -1,15 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
use App\Acl;
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity;
|
||||
use App\Enums\GlobalPermissions;
|
||||
use App\Environment;
|
||||
use App\Security\SplitToken;
|
||||
use App\Tests\Module;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
abstract class CestAbstract
|
||||
{
|
||||
protected ContainerInterface $di;
|
||||
|
||||
protected App\Environment $environment;
|
||||
protected Environment $environment;
|
||||
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo;
|
||||
|
||||
|
@ -24,17 +30,17 @@ abstract class CestAbstract
|
|||
|
||||
private ?Entity\Station $test_station = null;
|
||||
|
||||
protected function _inject(App\Tests\Module $tests_module): void
|
||||
protected function _inject(Module $tests_module): void
|
||||
{
|
||||
$this->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 = []
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Frontend_ErrorCest extends CestAbstract
|
||||
{
|
||||
public function seeErrorPages(FunctionalTester $I): void
|
||||
public function seeErrorPages(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Verify error code pages.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Frontend_IndexCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function seeHomepage(FunctionalTester $I): void
|
||||
public function seeHomepage(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('See the proper data on the homepage.');
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Frontend_PublicCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
*/
|
||||
public function seePublicPage(FunctionalTester $I): void
|
||||
public function seePublicPage(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Verify that the public page displays.');
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Frontend_SetupCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
|
@ -8,7 +10,7 @@ class Frontend_SetupCest extends CestAbstract
|
|||
* @after setupStation
|
||||
* @after setupSettings
|
||||
*/
|
||||
public function setupStart(FunctionalTester $I): void
|
||||
public function setupStart(\FunctionalTester $I): void
|
||||
{
|
||||
$I->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');
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Station_MediaCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function editMedia(FunctionalTester $I): void
|
||||
public function editMedia(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Upload a song to a station.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Station_MountPointsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function editMountPoints(FunctionalTester $I): void
|
||||
public function editMountPoints(\FunctionalTester $I): void
|
||||
{
|
||||
$testStation = $this->getTestStation();
|
||||
$station_id = $testStation->getId();
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Station_PlaylistsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function editPlaylists(FunctionalTester $I): void
|
||||
public function editPlaylists(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('Create a station playlist.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Station_ProfileCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function editStationProfile(FunctionalTester $I): void
|
||||
public function editStationProfile(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('View and edit a station profile.');
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Station_RemoteRelaysCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function editRemoteRelays(FunctionalTester $I): void
|
||||
public function editRemoteRelays(\FunctionalTester $I): void
|
||||
{
|
||||
$testStation = $this->getTestStation();
|
||||
$station_id = $testStation->getId();
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Functional;
|
||||
|
||||
class Station_ReportsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function viewReports(FunctionalTester $I): void
|
||||
public function viewReports(\FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('View station reports.');
|
||||
|
|
@ -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"
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Unit;
|
||||
|
||||
use App\Utilities;
|
||||
|
||||
class ExportsTest extends \Codeception\Test\Unit
|
||||
{
|
||||
protected UnitTester $tester;
|
||||
protected \UnitTester $tester;
|
||||
|
||||
public function testExports()
|
||||
{
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Unit;
|
||||
|
||||
use App\Entity;
|
||||
use Carbon\CarbonImmutable;
|
||||
|
|
@ -1,23 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Unit;
|
||||
|
||||
use App\Entity;
|
||||
|
||||
class StationPlaylistTest extends \Codeception\Test\Unit
|
||||
{
|
||||
protected UnitTester $tester;
|
||||
protected \UnitTester $tester;
|
||||
|
||||
protected App\Radio\AutoDJ\Scheduler $scheduler;
|
||||
protected \App\Radio\AutoDJ\Scheduler $scheduler;
|
||||
|
||||
protected function _inject(App\Tests\Module $tests_module): void
|
||||
protected function _inject(\App\Tests\Module $tests_module): void
|
||||
{
|
||||
$di = $tests_module->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');
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Unit;
|
||||
|
||||
use App\Utilities\Strings;
|
||||
|
||||
class UtilitiesTest extends \Codeception\Test\Unit
|
||||
{
|
||||
protected UnitTester $tester;
|
||||
protected \UnitTester $tester;
|
||||
|
||||
public function testUtilities(): void
|
||||
{
|
|
@ -1,11 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Unit;
|
||||
|
||||
use App\Xml\Reader;
|
||||
use App\Xml\Writer;
|
||||
|
||||
class XmlTest extends \Codeception\Test\Unit
|
||||
{
|
||||
protected UnitTester $tester;
|
||||
protected \UnitTester $tester;
|
||||
|
||||
public function testXml(): void
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
// This is global bootstrap for autoloading
|
||||
$autoloader = require __DIR__.'/../vendor/autoload.php';
|
||||
$autoloader->addClassMap([
|
||||
'CestAbstract' => __DIR__.'/functional/CestAbstract.php',
|
||||
'Functional\CestAbstract' => __DIR__ . '/Functional/CestAbstract.php',
|
||||
]);
|
||||
|
||||
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader([$autoloader, 'loadClass']);
|
||||
|
|
|
@ -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
|
|
@ -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"
|
Loading…
Reference in New Issue