{{ loop.index }} |
- {% if modList.approved %}
- {{ tableMacro.icon('fas fa-check', 'Mod list approved'|trans) }}
+ {% if modList is instance_of('\\App\\Mods\\Entity\\ModList\\StandardModList') %}
+ {% if modList.approved %}
+ {{ tableMacro.icon('fas fa-check', 'Mod list approved'|trans) }}
+ {% endif %}
+ {% elseif modList is instance_of('\\App\\Mods\\Entity\\ModList\\ExternalModList') %}
+ {{ tableMacro.icon('fa fa-external-link-alt', 'Mod list external'|trans) }}
{% endif %}
|
{{ modList.name }}
- {# @var dlc \App\Mods\Entity\Dlc\Dlc #}
- {% for dlc in modList.dlcs %}
- {{ commonMacro.dlc_icon(dlc) }}
- {% endfor %}
+ {% if modList is instance_of('\\App\\Mods\\Entity\\ModList\\StandardModList') %}
+ {# @var modList \App\Mods\Entity\ModList\StandardModList #}
+ {# @var dlc \App\Mods\Entity\Dlc\Dlc #}
+ {% for dlc in modList.dlcs %}
+ {{ commonMacro.dlc_icon(dlc) }}
+ {% endfor %}
+ {% endif %}
|
{{ tableMacro.format_date(modList.lastUpdatedAt) }} |
diff --git a/templates/users/_partial/permissions/form.html.twig b/templates/users/_partial/permissions/form.html.twig
index aee39170..94be1522 100644
--- a/templates/users/_partial/permissions/form.html.twig
+++ b/templates/users/_partial/permissions/form.html.twig
@@ -50,10 +50,18 @@
{{ form_row(form.modListList) }}
- {{ form_row(form.modListCreate) }}
- {{ form_row(form.modListUpdate) }}
- {{ form_row(form.modListCopy) }}
- {{ form_row(form.modListDelete) }}
- {{ form_row(form.modListApprove) }}
+ {{ form_row(form.standardModListCreate) }}
+ {{ form_row(form.standardModListUpdate) }}
+ {{ form_row(form.standardModListCopy) }}
+ {{ form_row(form.standardModListDelete) }}
+ {{ form_row(form.standardModListApprove) }}
+
+
+
diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php
index c0d9d9b8..b68e7688 100644
--- a/tests/_support/FunctionalTester.php
+++ b/tests/_support/FunctionalTester.php
@@ -5,6 +5,7 @@
namespace App\Tests;
use App\Shared\Test\Traits\TimeTrait;
+use App\Tests\Traits\CommonAssertsTrait;
use App\Tests\Traits\CommonPageAssertsTrait;
use App\Tests\Traits\DataTableAssertsTrait;
use App\Tests\Traits\ResponseAssertTrait;
@@ -30,6 +31,7 @@
class FunctionalTester extends Actor
{
use _generated\FunctionalTesterActions;
+ use CommonAssertsTrait;
use CommonPageAssertsTrait;
use DataTableAssertsTrait;
use ResponseAssertTrait;
diff --git a/tests/_support/Traits/CommonAssertsTrait.php b/tests/_support/Traits/CommonAssertsTrait.php
new file mode 100644
index 00000000..cbaf75b2
--- /dev/null
+++ b/tests/_support/Traits/CommonAssertsTrait.php
@@ -0,0 +1,13 @@
+assertSame(sort($expected), sort($actual));
+ }
+}
diff --git a/tests/functional/Mods/Api/ModList/GetModListsByIdCest.php b/tests/functional/Mods/Api/ModList/GetModListsByIdCest.php
index b4102971..9140e3dd 100644
--- a/tests/functional/Mods/Api/ModList/GetModListsByIdCest.php
+++ b/tests/functional/Mods/Api/ModList/GetModListsByIdCest.php
@@ -4,7 +4,7 @@
namespace App\Tests\Functional\Mods\Api\ModList;
-use App\Mods\DataFixtures\ModList\DefaultModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\DefaultStandardModListFixture;
use App\Tests\FunctionalTester;
use Codeception\Util\HttpCode;
@@ -18,7 +18,7 @@ public function _before(FunctionalTester $I): void
public function getModListByIdWithoutApiKey(FunctionalTester $I): void
{
- $I->sendGet(sprintf('/api/mod-lists/%s', DefaultModListFixture::ID));
+ $I->sendGet(sprintf('/api/mod-lists/%s', DefaultStandardModListFixture::ID));
$I->seeResponseCodeIs(HttpCode::OK);
$I->seeResponseContainsJson($this->getExpectedPayload());
@@ -28,7 +28,7 @@ public function getModListByIdUsingInvalidApiKey(FunctionalTester $I): void
{
$I->amApiKeyAuthenticatedAs('invalid_key');
- $I->sendGet(sprintf('/api/mod-lists/%s', DefaultModListFixture::ID));
+ $I->sendGet(sprintf('/api/mod-lists/%s', DefaultStandardModListFixture::ID));
$I->seeResponseCodeIs(HttpCode::OK);
$I->seeResponseContainsJson($this->getExpectedPayload());
@@ -38,7 +38,7 @@ public function getModListByIdUsingValidApiKey(FunctionalTester $I): void
{
$I->amApiKeyAuthenticatedAs('test_key');
- $I->sendGet(sprintf('/api/mod-lists/%s', DefaultModListFixture::ID));
+ $I->sendGet(sprintf('/api/mod-lists/%s', DefaultStandardModListFixture::ID));
$I->seeResponseCodeIs(HttpCode::OK);
$I->seeResponseContainsJson($this->getExpectedPayload());
diff --git a/tests/functional/Mods/Api/ModList/GetModListsByNameCest.php b/tests/functional/Mods/Api/ModList/GetModListsByNameCest.php
index 9d64c5fd..e693c130 100644
--- a/tests/functional/Mods/Api/ModList/GetModListsByNameCest.php
+++ b/tests/functional/Mods/Api/ModList/GetModListsByNameCest.php
@@ -4,7 +4,7 @@
namespace App\Tests\Functional\Mods\Api\ModList;
-use App\Mods\DataFixtures\ModList\DefaultModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\DefaultStandardModListFixture;
use App\Tests\FunctionalTester;
use Codeception\Util\HttpCode;
@@ -18,7 +18,7 @@ public function _before(FunctionalTester $I): void
public function getModListByNameWithoutApiKey(FunctionalTester $I): void
{
- $I->sendGet(sprintf('/api/mod-lists/by-name/%s', DefaultModListFixture::NAME));
+ $I->sendGet(sprintf('/api/mod-lists/by-name/%s', DefaultStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
$I->seeResponseContainsJson($this->getExpectedPayload());
@@ -28,7 +28,7 @@ public function getModListByNameUsingInvalidApiKey(FunctionalTester $I): void
{
$I->amApiKeyAuthenticatedAs('invalid_key');
- $I->sendGet(sprintf('/api/mod-lists/by-name/%s', DefaultModListFixture::NAME));
+ $I->sendGet(sprintf('/api/mod-lists/by-name/%s', DefaultStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
$I->seeResponseContainsJson($this->getExpectedPayload());
@@ -38,7 +38,7 @@ public function getModListByNameUsingValidApiKey(FunctionalTester $I): void
{
$I->amApiKeyAuthenticatedAs('test_key');
- $I->sendGet(sprintf('/api/mod-lists/by-name/%s', DefaultModListFixture::NAME));
+ $I->sendGet(sprintf('/api/mod-lists/by-name/%s', DefaultStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
$I->seeResponseContainsJson($this->getExpectedPayload());
diff --git a/tests/functional/Mods/Web/ModList/Common/ListModListsCest.php b/tests/functional/Mods/Web/ModList/Common/ListModListsCest.php
new file mode 100644
index 00000000..5588b273
--- /dev/null
+++ b/tests/functional/Mods/Web/ModList/Common/ListModListsCest.php
@@ -0,0 +1,321 @@
+stopFollowingRedirects();
+ }
+
+ public function listModListsAsUnauthenticatedUser(FunctionalTester $I): void
+ {
+ $I->amOnPage('/mod-list/list');
+ $I->seeResponseRedirectsToLogInAction();
+ }
+
+ public function listModListsAsUnauthorizedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID);
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::FORBIDDEN);
+ }
+
+ public function listModListsAsAuthorizedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->dontSeeLink('Create mod list');
+ $I->dontSeeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Edit mod list');
+ $I->dontSeeActionButton('Copy and edit mod list');
+ $I->dontSeeActionButton('Delete mod list');
+ }
+
+ public function listModListsAsAuthorizedUserWithPermissionsToCreateBothTypesOfModList(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ $user->getPermissions()->standardModListCreate = true;
+ $user->getPermissions()->externalModListCreate = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeLink('Create mod list');
+ $I->seeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Edit mod list');
+ $I->dontSeeActionButton('Copy and edit mod list');
+ $I->dontSeeActionButton('Delete mod list');
+ }
+
+ public function listModListsAsAuthorizedUserWithCreateStandardModListPermission(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ $user->getPermissions()->standardModListCreate = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeLink('Create mod list');
+ $I->dontSeeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Edit mod list');
+ $I->dontSeeActionButton('Copy and edit mod list');
+ $I->dontSeeActionButton('Delete mod list');
+ }
+
+ public function listModListsAsAuthorizedUserWithUpdateStandardModListPermission(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ $user->getPermissions()->standardModListUpdate = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->dontSeeLink('Create mod list');
+ $I->dontSeeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->seeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', CupStandardModListFixture::NAME));
+ $I->dontSeeActionButton('Edit mod list', sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+ $I->dontSeeActionButton('Edit mod list', sprintf('/external-mod-list/%s/update', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Copy and edit mod list');
+ $I->dontSeeActionButton('Delete mod list');
+ }
+
+ public function listModListsAsAuthorizedUserWithStandardModListOwnership(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(CupStandardModListFixture::OWNER_ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->dontSeeLink('Create mod list');
+ $I->dontSeeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->seeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', CupStandardModListFixture::NAME));
+ $I->dontSeeActionButton('Edit mod list', sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+ $I->dontSeeActionButton('Edit mod list', sprintf('/external-mod-list/%s/update', LocalhostExternalModList::NAME));
+ $I->dontSeeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', DefaultStandardModListFixture::NAME));
+ $I->dontSeeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Copy and edit mod list');
+
+ $I->seeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', CupStandardModListFixture::NAME));
+ $I->dontSeeActionButton('Delete mod list', sprintf('/external-mod-list/%s/delete', GoogleExternalModList::NAME));
+ $I->dontSeeActionButton('Delete mod list', sprintf('/external-mod-list/%s/delete', LocalhostExternalModList::NAME));
+ $I->dontSeeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', DefaultStandardModListFixture::NAME));
+ $I->dontSeeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', RhsStandardModListFixture::NAME));
+ }
+
+ public function listModListsAsAuthorizedUserWithCopyStandardModListPermission(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ $user->getPermissions()->standardModListCopy = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->dontSeeLink('Create mod list');
+ $I->dontSeeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Edit mod list');
+
+ $I->seeActionButton('Copy and edit mod list', sprintf('/standard-mod-list/%s/copy', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Copy and edit mod list', sprintf('/standard-mod-list/%s/copy', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Copy and edit mod list', sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Delete mod list');
+ }
+
+ public function listModListsAsAuthorizedUserWithDeleteStandardModListPermission(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ $user->getPermissions()->standardModListDelete = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->dontSeeLink('Create mod list');
+ $I->dontSeeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Edit mod list');
+ $I->dontSeeActionButton('Copy and edit mod list');
+
+ $I->seeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', CupStandardModListFixture::NAME));
+ $I->dontSeeActionButton('Delete mod list', sprintf('/external-mod-list/%s/delete', GoogleExternalModList::NAME));
+ $I->dontSeeActionButton('Delete mod list', sprintf('/external-mod-list/%s/delete', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', RhsStandardModListFixture::NAME));
+ }
+
+ public function listModListsAsAuthorizedUserWithCreateExternalModListPermission(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ $user->getPermissions()->externalModListCreate = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->dontSeeLink('Create mod list');
+ $I->seeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Edit mod list');
+ $I->dontSeeActionButton('Copy and edit mod list');
+ $I->dontSeeActionButton('Delete mod list');
+ }
+
+ public function listModListsAsAuthorizedUserWithUpdateExternalModListPermission(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ $user->getPermissions()->externalModListUpdate = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->dontSeeLink('Create mod list');
+ $I->dontSeeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Edit mod list', sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+ $I->seeActionButton('Edit mod list', sprintf('/external-mod-list/%s/update', LocalhostExternalModList::NAME));
+ $I->dontSeeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', DefaultStandardModListFixture::NAME));
+ $I->dontSeeActionButton('Edit mod list', sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Copy and edit mod list');
+ $I->dontSeeActionButton('Delete mod list');
+ }
+
+ public function listModListsAsAuthorizedUserWithDeleteExternalModListPermission(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
+ $user->getPermissions()->modListList = true;
+ $user->getPermissions()->externalModListDelete = true;
+ });
+
+ $I->amOnPage('/mod-list/list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->dontSeeLink('Create mod list');
+ $I->dontSeeLink('Create external mod list');
+
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', LocalhostExternalModList::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
+ $I->seeActionButton('Download mod list', sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
+
+ $I->dontSeeActionButton('Edit mod list');
+ $I->dontSeeActionButton('Copy and edit mod list');
+
+ $I->dontSeeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', CupStandardModListFixture::NAME));
+ $I->seeActionButton('Delete mod list', sprintf('/external-mod-list/%s/delete', GoogleExternalModList::NAME));
+ $I->seeActionButton('Delete mod list', sprintf('/external-mod-list/%s/delete', LocalhostExternalModList::NAME));
+ $I->dontSeeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', DefaultStandardModListFixture::NAME));
+ $I->dontSeeActionButton('Delete mod list', sprintf('/standard-mod-list/%s/delete', RhsStandardModListFixture::NAME));
+ }
+}
diff --git a/tests/functional/Mods/Web/ModList/DeleteModListCest.php b/tests/functional/Mods/Web/ModList/DeleteModListCest.php
deleted file mode 100644
index b8dbd8e3..00000000
--- a/tests/functional/Mods/Web/ModList/DeleteModListCest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-stopFollowingRedirects();
- }
-
- public function deleteModListAsUnauthenticatedUser(FunctionalTester $I): void
- {
- $I->amOnPage(sprintf('/mod-list/%s/delete', DefaultModListFixture::NAME));
-
- $I->seeResponseRedirectsToLogInAction();
-
- $I->seeInRepository(ModList::class, ['name' => DefaultModListFixture::NAME]);
- }
-
- public function deleteModListAsUnauthorizedUser(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User1Fixture::ID);
-
- $I->amOnPage(sprintf('/mod-list/%s/delete', DefaultModListFixture::NAME));
-
- $I->seeResponseCodeIs(HttpCode::FORBIDDEN);
-
- $I->seeInRepository(ModList::class, ['name' => DefaultModListFixture::NAME]);
- }
-
- public function deleteModListAsAuthorizedUser(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListDelete = true;
- });
-
- $I->amOnPage(sprintf('/mod-list/%s/delete', DefaultModListFixture::NAME));
-
- $I->seeResponseRedirectsTo('/mod-list/list');
-
- $I->dontSeeInRepository(ModList::class, ['name' => DefaultModListFixture::NAME]);
- }
-
- public function deleteModListAsModListOwner(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(CupModListFixture::OWNER_ID, function (User $user): void {
- $user->getPermissions()->modListDelete = false;
- });
-
- $I->amOnPage(sprintf('/mod-list/%s/delete', CupModListFixture::NAME));
-
- $I->seeResponseRedirectsTo('/mod-list/list');
-
- $I->dontSeeInRepository(ModList::class, ['name' => CupModListFixture::NAME]);
- }
-
- public function deleteModListAsAuthorizedUserWhenModListDoesNotExist(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListDelete = true;
- });
-
- $I->amOnPage(sprintf('/mod-list/%s/delete', 'non existing'));
-
- $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
- }
-}
diff --git a/tests/functional/Mods/Web/ModList/External/CreateExternalModListCest.php b/tests/functional/Mods/Web/ModList/External/CreateExternalModListCest.php
new file mode 100644
index 00000000..1d73c757
--- /dev/null
+++ b/tests/functional/Mods/Web/ModList/External/CreateExternalModListCest.php
@@ -0,0 +1,161 @@
+stopFollowingRedirects();
+ $I->freezeTime('2020-01-01T00:00:00+00:00');
+
+ /** @var IdentifierFactoryStub $identifierFactory */
+ $identifierFactory = $I->grabService(IdentifierFactoryStub::class);
+ $identifierFactory->setIdentifiers([
+ Uuid::fromString('805c9fcd-d674-4a27-8f0c-78dbf2484bb2'),
+ ]);
+ }
+
+ public function createExternalModListAsUnauthenticatedUser(FunctionalTester $I): void
+ {
+ $I->amOnPage('/external-mod-list/create');
+
+ $I->seeResponseRedirectsToLogInAction();
+ }
+
+ public function createExternalModListAsUnauthorizedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID);
+
+ $I->amOnPage('/external-mod-list/create');
+
+ $I->seeResponseCodeIs(HttpCode::FORBIDDEN);
+ }
+
+ public function createExternalModListAsAuthorizedUser(FunctionalTester $I): void
+ {
+ $currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListCreate = true;
+ });
+
+ $I->amOnPage('/external-mod-list/create');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ // Default form values
+ $I->seeInField('Mod list name', '');
+ $I->seeInField('Mod list description', '');
+ $I->seeInField('Mod list url', '');
+ $I->seeCheckboxIsChecked('Mod list active');
+
+ // Fill form
+ $I->fillField('Mod list name', 'External');
+ $I->fillField('Mod list description', 'External modlist');
+ $I->fillField('Mod list url', 'https://external.local');
+ $I->uncheckOption('Mod list active');
+ $I->click('Create mod list');
+
+ $I->seeResponseRedirectsTo('/mod-list/list');
+
+ /** @var ExternalModList $modList */
+ $modList = $I->grabEntityFromRepository(ExternalModList::class, ['name' => 'External']);
+ $I->assertSame('805c9fcd-d674-4a27-8f0c-78dbf2484bb2', $modList->getId()->toString());
+ $I->assertSame('External', $modList->getName());
+ $I->assertSame('External modlist', $modList->getDescription());
+ $I->assertSame('https://external.local', $modList->getUrl());
+ $I->assertSame(false, $modList->isActive());
+
+ $I->assertSame('2020-01-01T00:00:00+00:00', $modList->getCreatedAt()->format(DATE_ATOM));
+ $I->assertSame($currentUser->getId()->toString(), $modList->getCreatedBy()?->getId()->toString());
+ $I->assertSame(null, $modList->getLastUpdatedAt());
+ $I->assertSame(null, $modList->getLastUpdatedBy()?->getId()->toString());
+ }
+
+ public function createExternalModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListCreate = true;
+ });
+
+ $I->amOnPage('/external-mod-list/create');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->fillField('Mod list name', GoogleExternalModList::NAME);
+ $I->click('Create mod list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeFormErrorMessage('name', 'Mod list with the same name "Google" already exist.');
+ }
+
+ public function createExternalModListAsAuthorizedUserWithoutRequiredData(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListCreate = true;
+ });
+
+ $I->amOnPage('/external-mod-list/create');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->fillField('Mod list name', '');
+ $I->fillField('Mod list url', '');
+ $I->click('Create mod list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeFormErrorMessage('name', 'This value should not be blank.');
+ $I->seeFormErrorMessage('url', 'This value should not be blank.');
+ }
+
+ public function createExternalModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListCreate = true;
+ });
+
+ $I->amOnPage('/external-mod-list/create');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->fillField('Mod list name', str_repeat('a', 256));
+ $I->fillField('Mod list description', str_repeat('a', 256));
+ $I->click('Create mod list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeFormErrorMessage('name', 'This value is too long. It should have 255 characters or less.');
+ $I->seeFormErrorMessage('description', 'This value is too long. It should have 255 characters or less.');
+ }
+
+ public function createExternalModListAsAuthorizedUserWithDataInvalid(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListCreate = true;
+ });
+
+ $I->amOnPage('/external-mod-list/create');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->fillField('Mod list name', 'External');
+ $I->fillField('Mod list url', 'invalid');
+ $I->click('Create mod list');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeFormErrorMessage('url', 'This value is not a valid URL.');
+ }
+}
diff --git a/tests/functional/Mods/Web/ModList/External/DeleteExternalModListCest.php b/tests/functional/Mods/Web/ModList/External/DeleteExternalModListCest.php
new file mode 100644
index 00000000..78c07fe1
--- /dev/null
+++ b/tests/functional/Mods/Web/ModList/External/DeleteExternalModListCest.php
@@ -0,0 +1,64 @@
+stopFollowingRedirects();
+ }
+
+ public function deleteExternalModListAsUnauthenticatedUser(FunctionalTester $I): void
+ {
+ $I->amOnPage(sprintf('/external-mod-list/%s/delete', GoogleExternalModList::NAME));
+
+ $I->seeResponseRedirectsToLogInAction();
+
+ $I->seeInRepository(ExternalModList::class, ['name' => GoogleExternalModList::NAME]);
+ }
+
+ public function deleteExternalModListAsUnauthorizedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID);
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/delete', GoogleExternalModList::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::FORBIDDEN);
+
+ $I->seeInRepository(ExternalModList::class, ['name' => GoogleExternalModList::NAME]);
+ }
+
+ public function deleteExternalModListAsAuthorizedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListDelete = true;
+ });
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/delete', GoogleExternalModList::NAME));
+
+ $I->seeResponseRedirectsTo('/mod-list/list');
+
+ $I->dontSeeInRepository(ExternalModList::class, ['name' => GoogleExternalModList::NAME]);
+ }
+
+ public function deleteExternalModListAsAuthorizedUserWhenModListDoesNotExist(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListDelete = true;
+ });
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/delete', 'non existing'));
+
+ $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
+ }
+}
diff --git a/tests/functional/Mods/Web/ModList/External/UpdateExternalModListCest.php b/tests/functional/Mods/Web/ModList/External/UpdateExternalModListCest.php
new file mode 100644
index 00000000..72198f34
--- /dev/null
+++ b/tests/functional/Mods/Web/ModList/External/UpdateExternalModListCest.php
@@ -0,0 +1,162 @@
+stopFollowingRedirects();
+ $I->freezeTime('2021-01-01T00:00:00+00:00');
+ }
+
+ public function updateExternalModListAsUnauthenticatedUser(FunctionalTester $I): void
+ {
+ $I->amOnPage(sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+
+ $I->seeResponseRedirectsToLogInAction();
+ }
+
+ public function updateExternalModListAsUnauthorizedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID);
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::FORBIDDEN);
+ }
+
+ public function updateExternalModListAsAuthorizedUser(FunctionalTester $I): void
+ {
+ $currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListUpdate = true;
+ });
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ // Default form values
+ $I->seeInField('Mod list name', 'Google');
+ $I->seeInField('Mod list description', '');
+ $I->dontSeeCheckboxIsChecked('Mod list active');
+
+ // Fill form
+ $I->fillField('Mod list name', 'External');
+ $I->fillField('Mod list description', 'External modlist');
+ $I->fillField('Mod list url', 'https://external.local');
+ $I->checkOption('Mod list active');
+ $I->click('Apply');
+
+ $I->seeResponseRedirectsTo('/mod-list/list');
+
+ /** @var ExternalModList $modList */
+ $modList = $I->grabEntityFromRepository(ExternalModList::class, ['name' => 'External']);
+ $I->assertSame('296cc791-c73f-4978-b377-da1d3aa28cfb', $modList->getId()->toString());
+ $I->assertSame('External', $modList->getName());
+ $I->assertSame('External modlist', $modList->getDescription());
+ $I->assertSame('https://external.local', $modList->getUrl());
+ $I->assertSame(true, $modList->isActive());
+
+ $I->assertSame('2020-01-01T00:00:00+00:00', $modList->getCreatedAt()->format(DATE_ATOM));
+ $I->assertSame(GoogleExternalModList::CREATED_BY_ID, $modList->getCreatedBy()->getId()->toString());
+ $I->assertSame('2021-01-01T00:00:00+00:00', $modList->getLastUpdatedAt()?->format(DATE_ATOM));
+ $I->assertSame($currentUser->getId()->toString(), $modList->getLastUpdatedBy()?->getId()->toString());
+ }
+
+ public function updateExternalModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListUpdate = true;
+ });
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->fillField('Mod list name', DefaultStandardModListFixture::NAME);
+ $I->click('Apply');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeFormErrorMessage('name', 'Mod list with the same name "Default" already exist.');
+ }
+
+ public function updateExternalModListAsAuthorizedUserWithoutRequiredData(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListUpdate = true;
+ });
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->fillField('Mod list name', '');
+ $I->click('Apply');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeFormErrorMessage('name', 'This value should not be blank.');
+ }
+
+ public function updateExternalModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListUpdate = true;
+ });
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->fillField('Mod list name', str_repeat('a', 256));
+ $I->fillField('Mod list description', str_repeat('a', 256));
+ $I->click('Apply');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeFormErrorMessage('name', 'This value is too long. It should have 255 characters or less.');
+ $I->seeFormErrorMessage('description', 'This value is too long. It should have 255 characters or less.');
+ }
+
+ public function updateExternalModListAsAuthorizedUserWithDataInvalid(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListUpdate = true;
+ });
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/update', GoogleExternalModList::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->fillField('Mod list name', 'External');
+ $I->fillField('Mod list url', 'invalid');
+ $I->click('Apply');
+
+ $I->seeResponseCodeIs(HttpCode::OK);
+
+ $I->seeFormErrorMessage('url', 'This value is not a valid URL.');
+ }
+
+ public function updateExternalModListAsAuthorizedUserWhenModListDoesNotExist(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->externalModListUpdate = true;
+ });
+
+ $I->amOnPage(sprintf('/external-mod-list/%s/update', 'non existing'));
+
+ $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
+ }
+}
diff --git a/tests/functional/Mods/Web/ModList/ListModListsCest.php b/tests/functional/Mods/Web/ModList/ListModListsCest.php
deleted file mode 100644
index 21d5c825..00000000
--- a/tests/functional/Mods/Web/ModList/ListModListsCest.php
+++ /dev/null
@@ -1,140 +0,0 @@
-stopFollowingRedirects();
- }
-
- public function listModListsAsUnauthenticatedUser(FunctionalTester $I): void
- {
- $I->amOnPage('/mod-list/list');
- $I->seeResponseRedirectsToLogInAction();
- }
-
- public function listModListsAsUnauthorizedUser(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User3Fixture::ID);
-
- $I->amOnPage('/mod-list/list');
-
- $I->seeResponseCodeIs(HttpCode::FORBIDDEN);
- }
-
- public function listModListsAsAuthorizedUser(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListList = true;
- });
-
- $I->amOnPage('/mod-list/list');
-
- $I->seeResponseCodeIs(HttpCode::OK);
-
- $I->dontSeeLink('Create mod list');
- $I->seeActionButton('Download mod list');
- $I->dontSeeActionButton('Edit mod list');
- $I->dontSeeActionButton('Copy and edit mod list');
- $I->dontSeeActionButton('Delete mod list');
- }
-
- public function listModListsAsAuthorizedUserWithCreateModListPermission(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListList = true;
- $user->getPermissions()->modListCreate = true;
- });
-
- $I->amOnPage('/mod-list/list');
-
- $I->seeResponseCodeIs(HttpCode::OK);
-
- $I->seeLink('Create mod list');
- $I->seeActionButton('Download mod list');
- $I->dontSeeActionButton('Edit mod list');
- $I->dontSeeActionButton('Copy and edit mod list');
- $I->dontSeeActionButton('Delete mod list');
- }
-
- public function listModListsAsAuthorizedUserWithUpdateModListPermission(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListList = true;
- $user->getPermissions()->modListUpdate = true;
- });
-
- $I->amOnPage('/mod-list/list');
-
- $I->seeResponseCodeIs(HttpCode::OK);
-
- $I->dontSeeLink('Create mod list');
- $I->seeActionButton('Download mod list');
- $I->seeActionButton('Edit mod list');
- $I->dontSeeActionButton('Copy and edit mod list');
- $I->dontSeeActionButton('Delete mod list');
- }
-
- public function listModListsAsAuthorizedUserWithModListOwnership(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(CupModListFixture::OWNER_ID, function (User $user): void {
- $user->getPermissions()->modListList = true;
- });
-
- $I->amOnPage('/mod-list/list');
-
- $I->seeResponseCodeIs(HttpCode::OK);
-
- $I->dontSeeLink('Create mod list');
- $I->seeActionButton('Download mod list');
- $I->seeActionButton('Edit mod list', '/mod-list/CUP/update');
- $I->dontSeeActionButton('Copy and edit mod list');
- $I->seeActionButton('Delete mod list', '/mod-list/CUP/delete');
- }
-
- public function listModListsAsAuthorizedUserWithCopyModListPermission(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListList = true;
- $user->getPermissions()->modListCopy = true;
- });
-
- $I->amOnPage('/mod-list/list');
-
- $I->seeResponseCodeIs(HttpCode::OK);
-
- $I->dontSeeLink('Create mod list');
- $I->seeActionButton('Download mod list');
- $I->dontSeeActionButton('Edit mod list');
- $I->seeActionButton('Copy and edit mod list');
- $I->dontSeeActionButton('Delete mod list');
- }
-
- public function listModListsAsAuthorizedUserWithDeleteModListPermission(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User3Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListList = true;
- $user->getPermissions()->modListDelete = true;
- });
-
- $I->amOnPage('/mod-list/list');
-
- $I->seeResponseCodeIs(HttpCode::OK);
-
- $I->dontSeeLink('Create mod list');
- $I->seeActionButton('Download mod list');
- $I->dontSeeActionButton('Edit mod list');
- $I->dontSeeActionButton('Copy and edit mod list');
- $I->seeActionButton('Delete mod list');
- }
-}
diff --git a/tests/functional/Mods/Web/ModList/CopyModListCest.php b/tests/functional/Mods/Web/ModList/Standard/CopyStandardModListCest.php
similarity index 77%
rename from tests/functional/Mods/Web/ModList/CopyModListCest.php
rename to tests/functional/Mods/Web/ModList/Standard/CopyStandardModListCest.php
index f057e7eb..2e55b78a 100644
--- a/tests/functional/Mods/Web/ModList/CopyModListCest.php
+++ b/tests/functional/Mods/Web/ModList/Standard/CopyStandardModListCest.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace App\Tests\Functional\Mods\Web\ModList;
+namespace App\Tests\Functional\Mods\Web\ModList\Standard;
use App\Mods\DataFixtures\Dlc\CslaIronCurtainDlcFixture;
use App\Mods\DataFixtures\Dlc\SogPrairieFireDlcFixture;
@@ -15,12 +15,12 @@
use App\Mods\DataFixtures\Mod\SteamWorkshop\Required\Disabled\ArmaForcesJbadBuildingFixModFixture;
use App\Mods\DataFixtures\ModGroup\CupModGroupFixture;
use App\Mods\DataFixtures\ModGroup\RhsModGroupFixture;
-use App\Mods\DataFixtures\ModList\DefaultModListFixture;
-use App\Mods\DataFixtures\ModList\RhsModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\DefaultStandardModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\RhsStandardModListFixture;
use App\Mods\Entity\Dlc\Dlc;
use App\Mods\Entity\Mod\AbstractMod;
use App\Mods\Entity\ModGroup\ModGroup;
-use App\Mods\Entity\ModList\ModList;
+use App\Mods\Entity\ModList\StandardModList;
use App\Shared\Service\IdentifierFactory\IdentifierFactoryStub;
use App\Tests\FunctionalTester;
use App\Users\DataFixtures\User\User1Fixture;
@@ -29,7 +29,7 @@
use Codeception\Util\HttpCode;
use Ramsey\Uuid\Uuid;
-class CopyModListCest
+class CopyStandardModListCest
{
public function _before(FunctionalTester $I): void
{
@@ -43,29 +43,29 @@ public function _before(FunctionalTester $I): void
]);
}
- public function copyModListAsUnauthenticatedUser(FunctionalTester $I): void
+ public function copyStandardModListAsUnauthenticatedUser(FunctionalTester $I): void
{
- $I->amOnPage(sprintf('/mod-list/%s/copy', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
$I->seeResponseRedirectsToLogInAction();
}
- public function copyModListAsUnauthorizedUser(FunctionalTester $I): void
+ public function copyStandardModListAsUnauthorizedUser(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID);
- $I->amOnPage(sprintf('/mod-list/%s/copy', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::FORBIDDEN);
}
- public function copyModListAsAuthorizedUser(FunctionalTester $I): void
+ public function copyStandardModListAsAuthorizedUser(FunctionalTester $I): void
{
$currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCopy = true;
+ $user->getPermissions()->standardModListCopy = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/copy', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -75,13 +75,13 @@ public function copyModListAsAuthorizedUser(FunctionalTester $I): void
$I->dontSee('Mod list owner');
$I->dontSeeCheckboxIsChecked('Mod list active');
$I->dontSee('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_', [
RhsModGroupFixture::ID,
]); // Same as the source mod list
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_', [
CslaIronCurtainDlcFixture::ID,
]); // Same as the source mod list
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_', [
R3ModFixture::ID,
ArmaScriptProfilerModFixture::ID,
@@ -106,8 +106,8 @@ public function copyModListAsAuthorizedUser(FunctionalTester $I): void
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('805c9fcd-d674-4a27-8f0c-78dbf2484bb2', $modList->getId()->toString());
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
@@ -134,14 +134,14 @@ public function copyModListAsAuthorizedUser(FunctionalTester $I): void
$I->assertSame(null, $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function copyModListAsAuthorizedUserWithModListApprovePermission(FunctionalTester $I): void
+ public function copyStandardModListAsAuthorizedUserWithModListApprovePermission(FunctionalTester $I): void
{
$currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCopy = true;
- $user->getPermissions()->modListApprove = true;
+ $user->getPermissions()->standardModListCopy = true;
+ $user->getPermissions()->standardModListApprove = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/copy', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -151,13 +151,13 @@ public function copyModListAsAuthorizedUserWithModListApprovePermission(Function
$I->dontSee('Mod list owner');
$I->dontSeeCheckboxIsChecked('Mod list active');
$I->dontSeeCheckboxIsChecked('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_', [
RhsModGroupFixture::ID,
]); // Same as the source mod list
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_', [
CslaIronCurtainDlcFixture::ID,
]); // Same as the source mod list
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_', [
R3ModFixture::ID,
ArmaScriptProfilerModFixture::ID,
@@ -183,8 +183,8 @@ public function copyModListAsAuthorizedUserWithModListApprovePermission(Function
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
$I->assertSame(User1Fixture::ID, $modList->getOwner()->getId()->toString()); // Current user
@@ -210,14 +210,14 @@ public function copyModListAsAuthorizedUserWithModListApprovePermission(Function
$I->assertSame(null, $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function copyModListAsAuthorizedUserWithModListUpdatePermission(FunctionalTester $I): void
+ public function copyStandardModListAsAuthorizedUserWithModListUpdatePermission(FunctionalTester $I): void
{
$currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCopy = true;
- $user->getPermissions()->modListUpdate = true;
+ $user->getPermissions()->standardModListCopy = true;
+ $user->getPermissions()->standardModListUpdate = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/copy', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -227,13 +227,13 @@ public function copyModListAsAuthorizedUserWithModListUpdatePermission(Functiona
$I->seeOptionIsSelected('Mod list owner', User1Fixture::USERNAME); // Current user
$I->dontSeeCheckboxIsChecked('Mod list active');
$I->dontSee('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_', [
RhsModGroupFixture::ID,
]); // Same as the source mod list
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_', [
CslaIronCurtainDlcFixture::ID,
]); // Same as the source mod list
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_', [
R3ModFixture::ID,
ArmaScriptProfilerModFixture::ID,
@@ -259,8 +259,8 @@ public function copyModListAsAuthorizedUserWithModListUpdatePermission(Functiona
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
$I->assertSame(User3Fixture::ID, $modList->getOwner()->getId()->toString());
@@ -286,17 +286,17 @@ public function copyModListAsAuthorizedUserWithModListUpdatePermission(Functiona
$I->assertSame(null, $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function copyModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTester $I): void
+ public function copyStandardModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCopy = true;
+ $user->getPermissions()->standardModListCopy = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/copy', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
- $I->fillField('Mod list name', DefaultModListFixture::NAME);
+ $I->fillField('Mod list name', DefaultStandardModListFixture::NAME);
$I->click('Create mod list');
$I->seeResponseCodeIs(HttpCode::OK);
@@ -304,13 +304,13 @@ public function copyModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTe
$I->seeFormErrorMessage('name', 'Mod list with the same name "Default" already exist.');
}
- public function copyModListAsAuthorizedUserWithoutRequiredData(FunctionalTester $I): void
+ public function copyStandardModListAsAuthorizedUserWithoutRequiredData(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCopy = true;
+ $user->getPermissions()->standardModListCopy = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/copy', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -322,13 +322,13 @@ public function copyModListAsAuthorizedUserWithoutRequiredData(FunctionalTester
$I->seeFormErrorMessage('name', 'This value should not be blank.');
}
- public function copyModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I): void
+ public function copyStandardModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCopy = true;
+ $user->getPermissions()->standardModListCopy = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/copy', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -342,13 +342,13 @@ public function copyModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I):
$I->seeFormErrorMessage('description', 'This value is too long. It should have 255 characters or less.');
}
- public function copyModListAsAuthorizedUserWhenModListDoesNotExist(FunctionalTester $I): void
+ public function copyStandardModListAsAuthorizedUserWhenModListDoesNotExist(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCopy = true;
+ $user->getPermissions()->standardModListCopy = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/copy', 'non existing'));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/copy', 'non existing'));
$I->seeResponseCodeIs(HttpCode::NOT_FOUND);
}
diff --git a/tests/functional/Mods/Web/ModList/CreateModListCest.php b/tests/functional/Mods/Web/ModList/Standard/CreateStandardModListCest.php
similarity index 71%
rename from tests/functional/Mods/Web/ModList/CreateModListCest.php
rename to tests/functional/Mods/Web/ModList/Standard/CreateStandardModListCest.php
index b220f79b..863f148b 100644
--- a/tests/functional/Mods/Web/ModList/CreateModListCest.php
+++ b/tests/functional/Mods/Web/ModList/Standard/CreateStandardModListCest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace App\Tests\Functional\Mods\Web\ModList;
+namespace App\Tests\Functional\Mods\Web\ModList\Standard;
use App\Mods\DataFixtures\Dlc\CslaIronCurtainDlcFixture;
use App\Mods\DataFixtures\Mod\SteamWorkshop\Required\RhsAfrfModFixture;
use App\Mods\DataFixtures\ModGroup\CupModGroupFixture;
-use App\Mods\DataFixtures\ModList\DefaultModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\DefaultStandardModListFixture;
use App\Mods\Entity\Dlc\Dlc;
use App\Mods\Entity\Mod\AbstractMod;
use App\Mods\Entity\ModGroup\ModGroup;
-use App\Mods\Entity\ModList\ModList;
+use App\Mods\Entity\ModList\StandardModList;
use App\Shared\Service\IdentifierFactory\IdentifierFactoryStub;
use App\Tests\FunctionalTester;
use App\Users\DataFixtures\User\User1Fixture;
@@ -20,7 +20,7 @@
use Codeception\Util\HttpCode;
use Ramsey\Uuid\Uuid;
-class CreateModListCest
+class CreateStandardModListCest
{
public function _before(FunctionalTester $I): void
{
@@ -34,29 +34,29 @@ public function _before(FunctionalTester $I): void
]);
}
- public function createModListAsUnauthenticatedUser(FunctionalTester $I): void
+ public function createStandardModListAsUnauthenticatedUser(FunctionalTester $I): void
{
- $I->amOnPage('/mod-list/create');
+ $I->amOnPage('/standard-mod-list/create');
$I->seeResponseRedirectsToLogInAction();
}
- public function createModListAsUnauthorizedUser(FunctionalTester $I): void
+ public function createStandardModListAsUnauthorizedUser(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID);
- $I->amOnPage('/mod-list/create');
+ $I->amOnPage('/standard-mod-list/create');
$I->seeResponseCodeIs(HttpCode::FORBIDDEN);
}
- public function createModListAsAuthorizedUser(FunctionalTester $I): void
+ public function createStandardModListAsAuthorizedUser(FunctionalTester $I): void
{
$currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCreate = true;
+ $user->getPermissions()->standardModListCreate = true;
});
- $I->amOnPage('/mod-list/create');
+ $I->amOnPage('/standard-mod-list/create');
$I->seeResponseCodeIs(HttpCode::OK);
@@ -66,9 +66,9 @@ public function createModListAsAuthorizedUser(FunctionalTester $I): void
$I->dontSee('Mod list owner');
$I->seeCheckboxIsChecked('Mod list active');
$I->dontSee('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_'); // All mod group checkboxes are unchecked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_'); // All DLC checkboxes are unchecked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_'); // All mod checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_'); // All mod group checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_'); // All DLC checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_'); // All mod checkboxes are unchecked
// Fill form
$I->fillField('Mod list name', 'Custom');
@@ -81,8 +81,8 @@ public function createModListAsAuthorizedUser(FunctionalTester $I): void
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('805c9fcd-d674-4a27-8f0c-78dbf2484bb2', $modList->getId()->toString());
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
@@ -105,14 +105,14 @@ public function createModListAsAuthorizedUser(FunctionalTester $I): void
$I->assertSame(null, $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function createModListAsAuthorizedUserWithModListUpdatePermission(FunctionalTester $I): void
+ public function createStandardModListAsAuthorizedUserWithModListUpdatePermission(FunctionalTester $I): void
{
$currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCreate = true;
- $user->getPermissions()->modListUpdate = true;
+ $user->getPermissions()->standardModListCreate = true;
+ $user->getPermissions()->standardModListUpdate = true;
});
- $I->amOnPage('/mod-list/create');
+ $I->amOnPage('/standard-mod-list/create');
$I->seeResponseCodeIs(HttpCode::OK);
@@ -122,9 +122,9 @@ public function createModListAsAuthorizedUserWithModListUpdatePermission(Functio
$I->seeOptionIsSelected('Mod list owner', User1Fixture::USERNAME);
$I->seeCheckboxIsChecked('Mod list active');
$I->dontSee('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_'); // All mod group checkboxes are unchecked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_'); // All DLC checkboxes are unchecked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_'); // All mod checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_'); // All mod group checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_'); // All DLC checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_'); // All mod checkboxes are unchecked
// Fill form
$I->fillField('Mod list name', 'Custom');
@@ -138,8 +138,8 @@ public function createModListAsAuthorizedUserWithModListUpdatePermission(Functio
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
$I->assertSame(User2Fixture::ID, $modList->getOwner()->getId()->toString()); // Current user
@@ -161,14 +161,14 @@ public function createModListAsAuthorizedUserWithModListUpdatePermission(Functio
$I->assertSame(null, $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function createModListAsAuthorizedUserWithModListApprovePermission(FunctionalTester $I): void
+ public function createStandardModListAsAuthorizedUserWithModListApprovePermission(FunctionalTester $I): void
{
$currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCreate = true;
- $user->getPermissions()->modListApprove = true;
+ $user->getPermissions()->standardModListCreate = true;
+ $user->getPermissions()->standardModListApprove = true;
});
- $I->amOnPage('/mod-list/create');
+ $I->amOnPage('/standard-mod-list/create');
$I->seeResponseCodeIs(HttpCode::OK);
@@ -178,9 +178,9 @@ public function createModListAsAuthorizedUserWithModListApprovePermission(Functi
$I->dontSee('Mod list owner');
$I->seeCheckboxIsChecked('Mod list active');
$I->dontSeeCheckboxIsChecked('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_'); // All mod group checkboxes are unchecked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_'); // All DLC checkboxes are unchecked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_'); // All mod checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_'); // All mod group checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_'); // All DLC checkboxes are unchecked
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_'); // All mod checkboxes are unchecked
// Fill form
$I->fillField('Mod list name', 'Custom');
@@ -194,8 +194,8 @@ public function createModListAsAuthorizedUserWithModListApprovePermission(Functi
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
$I->assertSame(User1Fixture::ID, $modList->getOwner()->getId()->toString()); // Current user
@@ -217,17 +217,17 @@ public function createModListAsAuthorizedUserWithModListApprovePermission(Functi
$I->assertSame(null, $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function createModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTester $I): void
+ public function createStandardModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCreate = true;
+ $user->getPermissions()->standardModListCreate = true;
});
- $I->amOnPage('/mod-list/create');
+ $I->amOnPage('/standard-mod-list/create');
$I->seeResponseCodeIs(HttpCode::OK);
- $I->fillField('Mod list name', DefaultModListFixture::NAME);
+ $I->fillField('Mod list name', DefaultStandardModListFixture::NAME);
$I->click('Create mod list');
$I->seeResponseCodeIs(HttpCode::OK);
@@ -235,13 +235,13 @@ public function createModListAsAuthorizedUserWhenModListAlreadyExists(Functional
$I->seeFormErrorMessage('name', 'Mod list with the same name "Default" already exist.');
}
- public function createModListAsAuthorizedUserWithoutRequiredData(FunctionalTester $I): void
+ public function createStandardModListAsAuthorizedUserWithoutRequiredData(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCreate = true;
+ $user->getPermissions()->standardModListCreate = true;
});
- $I->amOnPage('/mod-list/create');
+ $I->amOnPage('/standard-mod-list/create');
$I->seeResponseCodeIs(HttpCode::OK);
@@ -253,13 +253,13 @@ public function createModListAsAuthorizedUserWithoutRequiredData(FunctionalTeste
$I->seeFormErrorMessage('name', 'This value should not be blank.');
}
- public function createModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I): void
+ public function createStandardModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListCreate = true;
+ $user->getPermissions()->standardModListCreate = true;
});
- $I->amOnPage('/mod-list/create');
+ $I->amOnPage('/standard-mod-list/create');
$I->seeResponseCodeIs(HttpCode::OK);
diff --git a/tests/functional/Mods/Web/ModList/Standard/DeleteStandardModListCest.php b/tests/functional/Mods/Web/ModList/Standard/DeleteStandardModListCest.php
new file mode 100644
index 00000000..e5878e9b
--- /dev/null
+++ b/tests/functional/Mods/Web/ModList/Standard/DeleteStandardModListCest.php
@@ -0,0 +1,78 @@
+stopFollowingRedirects();
+ }
+
+ public function deleteStandardModListAsUnauthenticatedUser(FunctionalTester $I): void
+ {
+ $I->amOnPage(sprintf('/standard-mod-list/%s/delete', DefaultStandardModListFixture::NAME));
+
+ $I->seeResponseRedirectsToLogInAction();
+
+ $I->seeInRepository(StandardModList::class, ['name' => DefaultStandardModListFixture::NAME]);
+ }
+
+ public function deleteStandardModListAsUnauthorizedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID);
+
+ $I->amOnPage(sprintf('/standard-mod-list/%s/delete', DefaultStandardModListFixture::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::FORBIDDEN);
+
+ $I->seeInRepository(StandardModList::class, ['name' => DefaultStandardModListFixture::NAME]);
+ }
+
+ public function deleteStandardModListAsAuthorizedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->standardModListDelete = true;
+ });
+
+ $I->amOnPage(sprintf('/standard-mod-list/%s/delete', DefaultStandardModListFixture::NAME));
+
+ $I->seeResponseRedirectsTo('/mod-list/list');
+
+ $I->dontSeeInRepository(StandardModList::class, ['name' => DefaultStandardModListFixture::NAME]);
+ }
+
+ public function deleteStandardModListAsModListOwner(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(CupStandardModListFixture::OWNER_ID, function (User $user): void {
+ $user->getPermissions()->standardModListDelete = false;
+ });
+
+ $I->amOnPage(sprintf('/standard-mod-list/%s/delete', CupStandardModListFixture::NAME));
+
+ $I->seeResponseRedirectsTo('/mod-list/list');
+
+ $I->dontSeeInRepository(StandardModList::class, ['name' => CupStandardModListFixture::NAME]);
+ }
+
+ public function deleteStandardModListAsAuthorizedUserWhenModListDoesNotExist(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
+ $user->getPermissions()->standardModListDelete = true;
+ });
+
+ $I->amOnPage(sprintf('/standard-mod-list/%s/delete', 'non existing'));
+
+ $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
+ }
+}
diff --git a/tests/functional/Mods/Web/ModList/UpdateModListCest.php b/tests/functional/Mods/Web/ModList/Standard/UpdateStandardModListCest.php
similarity index 73%
rename from tests/functional/Mods/Web/ModList/UpdateModListCest.php
rename to tests/functional/Mods/Web/ModList/Standard/UpdateStandardModListCest.php
index 394687af..e88b5db6 100644
--- a/tests/functional/Mods/Web/ModList/UpdateModListCest.php
+++ b/tests/functional/Mods/Web/ModList/Standard/UpdateStandardModListCest.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace App\Tests\Functional\Mods\Web\ModList;
+namespace App\Tests\Functional\Mods\Web\ModList\Standard;
use App\Mods\DataFixtures\Dlc\CslaIronCurtainDlcFixture;
use App\Mods\DataFixtures\Dlc\SogPrairieFireDlcFixture;
@@ -15,12 +15,12 @@
use App\Mods\DataFixtures\Mod\SteamWorkshop\Required\Disabled\ArmaForcesJbadBuildingFixModFixture;
use App\Mods\DataFixtures\ModGroup\CupModGroupFixture;
use App\Mods\DataFixtures\ModGroup\RhsModGroupFixture;
-use App\Mods\DataFixtures\ModList\DefaultModListFixture;
-use App\Mods\DataFixtures\ModList\RhsModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\DefaultStandardModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\RhsStandardModListFixture;
use App\Mods\Entity\Dlc\Dlc;
use App\Mods\Entity\Mod\AbstractMod;
use App\Mods\Entity\ModGroup\ModGroup;
-use App\Mods\Entity\ModList\ModList;
+use App\Mods\Entity\ModList\StandardModList;
use App\Tests\FunctionalTester;
use App\Users\DataFixtures\User\User1Fixture;
use App\Users\DataFixtures\User\User2Fixture;
@@ -28,7 +28,7 @@
use App\Users\Entity\User\User;
use Codeception\Util\HttpCode;
-class UpdateModListCest
+class UpdateStandardModListCest
{
public function _before(FunctionalTester $I): void
{
@@ -36,29 +36,29 @@ public function _before(FunctionalTester $I): void
$I->freezeTime('2021-01-01T00:00:00+00:00');
}
- public function updateModListAsUnauthenticatedUser(FunctionalTester $I): void
+ public function updateStandardModListAsUnauthenticatedUser(FunctionalTester $I): void
{
- $I->amOnPage(sprintf('/mod-list/%s/update', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
$I->seeResponseRedirectsToLogInAction();
}
- public function updateModListAsUnauthorizedUser(FunctionalTester $I): void
+ public function updateStandardModListAsUnauthorizedUser(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID);
- $I->amOnPage(sprintf('/mod-list/%s/update', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::FORBIDDEN);
}
- public function updateModListAsAuthorizedUser(FunctionalTester $I): void
+ public function updateStandardModListAsAuthorizedUser(FunctionalTester $I): void
{
$currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListUpdate = true;
+ $user->getPermissions()->standardModListUpdate = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/update', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -68,13 +68,13 @@ public function updateModListAsAuthorizedUser(FunctionalTester $I): void
$I->seeOptionIsSelected('Mod list owner', User2Fixture::USERNAME);
$I->dontSeeCheckboxIsChecked('Mod list active');
$I->dontSee('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_', [
RhsModGroupFixture::ID,
]); // Some checkboxes checked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_', [
CslaIronCurtainDlcFixture::ID,
]); // Some checkboxes checked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_', [
R3ModFixture::ID,
ArmaScriptProfilerModFixture::ID,
@@ -100,8 +100,8 @@ public function updateModListAsAuthorizedUser(FunctionalTester $I): void
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
$I->assertSame(User3Fixture::ID, $modList->getOwner()->getId()->toString());
@@ -122,19 +122,19 @@ public function updateModListAsAuthorizedUser(FunctionalTester $I): void
], array_map(fn (AbstractMod $mod) => $mod->getId()->toString(), $modList->getMods()));
$I->assertSame('2020-01-01T00:00:00+00:00', $modList->getCreatedAt()->format(DATE_ATOM));
- $I->assertSame(RhsModListFixture::OWNER_ID, $modList->getCreatedBy()->getId()->toString());
+ $I->assertSame(RhsStandardModListFixture::OWNER_ID, $modList->getCreatedBy()->getId()->toString());
$I->assertSame('2021-01-01T00:00:00+00:00', $modList->getLastUpdatedAt()?->format(DATE_ATOM));
$I->assertSame($currentUser->getId()->toString(), $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function updateModListAsAuthorizedUserWithModListApprovePermission(FunctionalTester $I): void
+ public function updateStandardModListAsAuthorizedUserWithModListApprovePermission(FunctionalTester $I): void
{
$currentUser = $I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListUpdate = true;
- $user->getPermissions()->modListApprove = true;
+ $user->getPermissions()->standardModListUpdate = true;
+ $user->getPermissions()->standardModListApprove = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/update', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -144,13 +144,13 @@ public function updateModListAsAuthorizedUserWithModListApprovePermission(Functi
$I->seeOptionIsSelected('Mod list owner', User2Fixture::USERNAME);
$I->dontSeeCheckboxIsChecked('Mod list active');
$I->dontSeeCheckboxIsChecked('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_', [
RhsModGroupFixture::ID,
]); // Some checkboxes checked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_', [
CslaIronCurtainDlcFixture::ID,
]); // Some checkboxes checked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_', [
R3ModFixture::ID,
ArmaScriptProfilerModFixture::ID,
@@ -177,8 +177,8 @@ public function updateModListAsAuthorizedUserWithModListApprovePermission(Functi
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
$I->assertSame(User3Fixture::ID, $modList->getOwner()->getId()->toString());
@@ -199,18 +199,18 @@ public function updateModListAsAuthorizedUserWithModListApprovePermission(Functi
], array_map(fn (AbstractMod $mod) => $mod->getId()->toString(), $modList->getMods()));
$I->assertSame('2020-01-01T00:00:00+00:00', $modList->getCreatedAt()->format(DATE_ATOM));
- $I->assertSame(RhsModListFixture::OWNER_ID, $modList->getCreatedBy()->getId()->toString());
+ $I->assertSame(RhsStandardModListFixture::OWNER_ID, $modList->getCreatedBy()->getId()->toString());
$I->assertSame('2021-01-01T00:00:00+00:00', $modList->getLastUpdatedAt()?->format(DATE_ATOM));
$I->assertSame($currentUser->getId()->toString(), $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function updateModListAsModListOwner(FunctionalTester $I): void
+ public function updateStandardModListAsModListOwner(FunctionalTester $I): void
{
- $currentUser = $I->amDiscordAuthenticatedAs(RhsModListFixture::OWNER_ID, function (User $user): void {
- $user->getPermissions()->modListUpdate = false;
+ $currentUser = $I->amDiscordAuthenticatedAs(RhsStandardModListFixture::OWNER_ID, function (User $user): void {
+ $user->getPermissions()->standardModListUpdate = false;
});
- $I->amOnPage(sprintf('/mod-list/%s/update', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -220,13 +220,13 @@ public function updateModListAsModListOwner(FunctionalTester $I): void
$I->dontSee('Mod list owner');
$I->dontSeeCheckboxIsChecked('Mod list active');
$I->dontSee('Mod list approved');
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_modGroups_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_modGroups_', [
RhsModGroupFixture::ID,
]); // Some checkboxes checked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_dlcs_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_dlcs_', [
CslaIronCurtainDlcFixture::ID,
]); // Some checkboxes checked
- $I->seeTableRowCheckboxesAreUnchecked('mod_list_form_mods_', [
+ $I->seeTableRowCheckboxesAreUnchecked('standard_mod_list_form_mods_', [
R3ModFixture::ID,
ArmaScriptProfilerModFixture::ID,
@@ -251,11 +251,11 @@ public function updateModListAsModListOwner(FunctionalTester $I): void
$I->seeResponseRedirectsTo('/mod-list/list');
- /** @var ModList $modList */
- $modList = $I->grabEntityFromRepository(ModList::class, ['name' => 'Custom']);
+ /** @var StandardModList $modList */
+ $modList = $I->grabEntityFromRepository(StandardModList::class, ['name' => 'Custom']);
$I->assertSame('Custom', $modList->getName());
$I->assertSame('Custom modlist', $modList->getDescription());
- $I->assertSame(RhsModListFixture::OWNER_ID, $modList->getOwner()->getId()->toString());
+ $I->assertSame(RhsStandardModListFixture::OWNER_ID, $modList->getOwner()->getId()->toString());
$I->assertSame(true, $modList->isActive());
$I->assertSame(false, $modList->isApproved());
$I->assertSame([
@@ -273,22 +273,22 @@ public function updateModListAsModListOwner(FunctionalTester $I): void
], array_map(fn (AbstractMod $mod) => $mod->getId()->toString(), $modList->getMods()));
$I->assertSame('2020-01-01T00:00:00+00:00', $modList->getCreatedAt()->format(DATE_ATOM));
- $I->assertSame(RhsModListFixture::OWNER_ID, $modList->getCreatedBy()->getId()->toString());
+ $I->assertSame(RhsStandardModListFixture::OWNER_ID, $modList->getCreatedBy()->getId()->toString());
$I->assertSame('2021-01-01T00:00:00+00:00', $modList->getLastUpdatedAt()?->format(DATE_ATOM));
$I->assertSame($currentUser->getId()->toString(), $modList->getLastUpdatedBy()?->getId()->toString());
}
- public function updateModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTester $I): void
+ public function updateStandardModListAsAuthorizedUserWhenModListAlreadyExists(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListUpdate = true;
+ $user->getPermissions()->standardModListUpdate = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/update', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
- $I->fillField('Mod list name', DefaultModListFixture::NAME);
+ $I->fillField('Mod list name', DefaultStandardModListFixture::NAME);
$I->click('Apply');
$I->seeResponseCodeIs(HttpCode::OK);
@@ -296,13 +296,13 @@ public function updateModListAsAuthorizedUserWhenModListAlreadyExists(Functional
$I->seeFormErrorMessage('name', 'Mod list with the same name "Default" already exist.');
}
- public function updateModListAsAuthorizedUserWithoutRequiredData(FunctionalTester $I): void
+ public function updateStandardModListAsAuthorizedUserWithoutRequiredData(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListUpdate = true;
+ $user->getPermissions()->standardModListUpdate = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/update', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -314,13 +314,13 @@ public function updateModListAsAuthorizedUserWithoutRequiredData(FunctionalTeste
$I->seeFormErrorMessage('name', 'This value should not be blank.');
}
- public function updateModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I): void
+ public function updateStandardModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListUpdate = true;
+ $user->getPermissions()->standardModListUpdate = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/update', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -334,13 +334,13 @@ public function updateModListAsAuthorizedUserWithDataTooLong(FunctionalTester $I
$I->seeFormErrorMessage('description', 'This value is too long. It should have 255 characters or less.');
}
- public function updateModListAsAuthorizedUserWhenModListDoesNotExist(FunctionalTester $I): void
+ public function updateStandardModListAsAuthorizedUserWhenModListDoesNotExist(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID, function (User $user): void {
- $user->getPermissions()->modListUpdate = true;
+ $user->getPermissions()->standardModListUpdate = true;
});
- $I->amOnPage(sprintf('/mod-list/%s/update', 'non existing'));
+ $I->amOnPage(sprintf('/standard-mod-list/%s/update', 'non existing'));
$I->seeResponseCodeIs(HttpCode::NOT_FOUND);
}
diff --git a/tests/functional/Mods/Web/ModListPublic/Common/SelectModListCest.php b/tests/functional/Mods/Web/ModListPublic/Common/SelectModListCest.php
new file mode 100644
index 00000000..6e774187
--- /dev/null
+++ b/tests/functional/Mods/Web/ModListPublic/Common/SelectModListCest.php
@@ -0,0 +1,34 @@
+amOnPage('/mod-list/select');
+
+ $I->see(DefaultStandardModListFixture::NAME);
+ $I->see(CupStandardModListFixture::NAME);
+ $I->dontSee(RhsStandardModListFixture::NAME); // disabled
+ }
+
+ public function selectModListAsAuthenticatedUser(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID);
+
+ $I->amOnPage('/mod-list/select');
+
+ $I->see(DefaultStandardModListFixture::NAME);
+ $I->see(CupStandardModListFixture::NAME);
+ $I->dontSee(RhsStandardModListFixture::NAME); // disabled
+ }
+}
diff --git a/tests/functional/Mods/Web/ModListPublic/External/RedirectToExternalModListCest.php b/tests/functional/Mods/Web/ModListPublic/External/RedirectToExternalModListCest.php
new file mode 100644
index 00000000..152e7415
--- /dev/null
+++ b/tests/functional/Mods/Web/ModListPublic/External/RedirectToExternalModListCest.php
@@ -0,0 +1,53 @@
+freezeTime('2020-01-01T00:00:00+00:00');
+ }
+
+ public function redirectToExternalModListAsUnauthenticatedUser(FunctionalTester $I): void
+ {
+ /** @var ExternalModList $externalModList */
+ $externalModList = $I->grabEntityFromRepository(ExternalModList::class, ['name' => LocalhostExternalModList::NAME]);
+
+ $I->stopFollowingRedirects();
+ $I->amOnPage(sprintf('/mod-list/%s', $externalModList->getName()));
+
+ $I->seeResponseRedirectsTo($externalModList->getUrl());
+ }
+
+ public function redirectToExternalModListAsAuthenticatedUser(FunctionalTester $I): void
+ {
+ /** @var ExternalModList $externalModList */
+ $externalModList = $I->grabEntityFromRepository(ExternalModList::class, ['name' => LocalhostExternalModList::NAME]);
+
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID);
+
+ $I->stopFollowingRedirects();
+ $I->amOnPage(sprintf('/mod-list/%s', $externalModList->getName()));
+
+ $I->seeResponseRedirectsTo($externalModList->getUrl());
+ }
+
+ public function redirectToExternalModListAsAuthenticatedUserWhenModListInactive(FunctionalTester $I): void
+ {
+ $I->amDiscordAuthenticatedAs(User1Fixture::ID);
+
+ $I->amOnPage(sprintf('/mod-list/%s', GoogleExternalModList::NAME));
+
+ $I->seeResponseCodeIs(HttpCode::FORBIDDEN);
+ }
+}
diff --git a/tests/functional/Mods/Web/ModListPublic/SelectModListCest.php b/tests/functional/Mods/Web/ModListPublic/SelectModListCest.php
deleted file mode 100644
index bcf1df28..00000000
--- a/tests/functional/Mods/Web/ModListPublic/SelectModListCest.php
+++ /dev/null
@@ -1,34 +0,0 @@
-amOnPage('/mod-list/select');
-
- $I->see(DefaultModListFixture::NAME);
- $I->see(CupModListFixture::NAME);
- $I->dontSee(RhsModListFixture::NAME); // disabled
- }
-
- public function selectModListAsAuthenticatedUser(FunctionalTester $I): void
- {
- $I->amDiscordAuthenticatedAs(User1Fixture::ID);
-
- $I->amOnPage('/mod-list/select');
-
- $I->see(DefaultModListFixture::NAME);
- $I->see(CupModListFixture::NAME);
- $I->dontSee(RhsModListFixture::NAME); // disabled
- }
-}
diff --git a/tests/functional/Mods/Web/ModListPublic/CustomizeModListCest.php b/tests/functional/Mods/Web/ModListPublic/Standard/CustomizeStandardModListCest.php
similarity index 70%
rename from tests/functional/Mods/Web/ModListPublic/CustomizeModListCest.php
rename to tests/functional/Mods/Web/ModListPublic/Standard/CustomizeStandardModListCest.php
index d53aba97..325589eb 100644
--- a/tests/functional/Mods/Web/ModListPublic/CustomizeModListCest.php
+++ b/tests/functional/Mods/Web/ModListPublic/Standard/CustomizeStandardModListCest.php
@@ -2,15 +2,15 @@
declare(strict_types=1);
-namespace App\Tests\Functional\Mods\Web\ModListPublic;
+namespace App\Tests\Functional\Mods\Web\ModListPublic\Standard;
-use App\Mods\DataFixtures\ModList\DefaultModListFixture;
-use App\Mods\DataFixtures\ModList\RhsModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\DefaultStandardModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\RhsStandardModListFixture;
use App\Tests\FunctionalTester;
use App\Users\DataFixtures\User\User1Fixture;
use Codeception\Util\HttpCode;
-class CustomizeModListCest
+class CustomizeStandardModListCest
{
public function _before(FunctionalTester $I): void
{
@@ -19,7 +19,7 @@ public function _before(FunctionalTester $I): void
public function customizeModListAsUnauthenticatedUser(FunctionalTester $I): void
{
- $I->amOnPage(sprintf('/mod-list/%s', DefaultModListFixture::NAME));
+ $I->amOnPage(sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -33,7 +33,7 @@ public function customizeModListAsAuthenticatedUser(FunctionalTester $I): void
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID);
- $I->amOnPage(sprintf('/mod-list/%s', DefaultModListFixture::NAME));
+ $I->amOnPage(sprintf('/mod-list/%s', DefaultStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::OK);
@@ -47,7 +47,7 @@ public function customizeModListAsAuthenticatedUserWhenModListInactive(Functiona
{
$I->amDiscordAuthenticatedAs(User1Fixture::ID);
- $I->amOnPage(sprintf('/mod-list/%s', RhsModListFixture::NAME));
+ $I->amOnPage(sprintf('/mod-list/%s', RhsStandardModListFixture::NAME));
$I->seeResponseCodeIs(HttpCode::FORBIDDEN);
}
diff --git a/tests/functional/Mods/Web/ModListPublic/DownloadModListCest.php b/tests/functional/Mods/Web/ModListPublic/Standard/DownloadStandardModListCest.php
similarity index 92%
rename from tests/functional/Mods/Web/ModListPublic/DownloadModListCest.php
rename to tests/functional/Mods/Web/ModListPublic/Standard/DownloadStandardModListCest.php
index 7b79198d..b9a73f78 100644
--- a/tests/functional/Mods/Web/ModListPublic/DownloadModListCest.php
+++ b/tests/functional/Mods/Web/ModListPublic/Standard/DownloadStandardModListCest.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace App\Tests\Functional\Mods\Web\ModListPublic;
+namespace App\Tests\Functional\Mods\Web\ModListPublic\Standard;
use App\Mods\DataFixtures\Dlc\CslaIronCurtainDlcFixture;
use App\Mods\DataFixtures\Dlc\GlobalMobilizationDlcFixture;
@@ -20,15 +20,15 @@
use App\Mods\DataFixtures\Mod\SteamWorkshop\Required\RhsAfrfModFixture;
use App\Mods\DataFixtures\Mod\SteamWorkshop\Required\RhsGrefModFixture;
use App\Mods\DataFixtures\Mod\SteamWorkshop\Required\RhsUsafModFixture;
-use App\Mods\DataFixtures\ModList\DefaultModListFixture;
-use App\Mods\DataFixtures\ModList\RhsModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\DefaultStandardModListFixture;
+use App\Mods\DataFixtures\ModList\Standard\RhsStandardModListFixture;
use App\Mods\Entity\Dlc\Dlc;
use App\Mods\Entity\Mod\SteamWorkshopMod;
use App\Tests\FunctionalTester;
use App\Users\DataFixtures\User\User1Fixture;
use Codeception\Util\HttpCode;
-class DownloadModListCest
+class DownloadStandardModListCest
{
public function _before(FunctionalTester $I): void
{
@@ -42,7 +42,7 @@ public function downloadModListAsUnauthenticatedUser(FunctionalTester $I): void
'invalid',
];
- $I->amOnPage(sprintf('/mod-list/%s/download/%s', DefaultModListFixture::NAME, json_encode($optionalMods)));
+ $I->amOnPage(sprintf('/mod-list/%s/download/%s', DefaultStandardModListFixture::NAME, json_encode($optionalMods)));
$I->seeResponseContainsModListPresetWithMods('ArmaForces Default 2020_01_01 00_00.html', [
$I->grabEntityFromRepository(Dlc::class, ['id' => CslaIronCurtainDlcFixture::ID]),
@@ -73,7 +73,7 @@ public function downloadModListAsAuthenticatedUser(FunctionalTester $I): void
'invalid',
];
- $I->amOnPage(sprintf('/mod-list/%s/download/%s', DefaultModListFixture::NAME, json_encode($optionalMods)));
+ $I->amOnPage(sprintf('/mod-list/%s/download/%s', DefaultStandardModListFixture::NAME, json_encode($optionalMods)));
$I->seeResponseContainsModListPresetWithMods('ArmaForces Default 2020_01_01 00_00.html', [
$I->grabEntityFromRepository(Dlc::class, ['id' => CslaIronCurtainDlcFixture::ID]),
@@ -104,7 +104,7 @@ public function downloadModListAsAuthenticatedUserWhenModListInactive(Functional
'invalid',
];
- $I->amOnPage(sprintf('/mod-list/%s/download/%s', RhsModListFixture::NAME, json_encode($optionalMods)));
+ $I->amOnPage(sprintf('/mod-list/%s/download/%s', RhsStandardModListFixture::NAME, json_encode($optionalMods)));
$I->seeResponseCodeIs(HttpCode::FORBIDDEN);
}
diff --git a/tests/functional/Users/Web/User/UpdateUserCest.php b/tests/functional/Users/Web/User/UpdateUserCest.php
index c778fe25..20bc9e60 100644
--- a/tests/functional/Users/Web/User/UpdateUserCest.php
+++ b/tests/functional/Users/Web/User/UpdateUserCest.php
@@ -150,11 +150,11 @@ public function updateUserAsAuthorizedUser(FunctionalTester $I): void
$I->assertTrue($user->getPermissions()->dlcDelete);
$I->assertTrue($user->getPermissions()->modListList);
- $I->assertTrue($user->getPermissions()->modListCreate);
- $I->assertTrue($user->getPermissions()->modListUpdate);
- $I->assertTrue($user->getPermissions()->modListCopy);
- $I->assertTrue($user->getPermissions()->modListDelete);
- $I->assertTrue($user->getPermissions()->modListApprove);
+ $I->assertTrue($user->getPermissions()->standardModListCreate);
+ $I->assertTrue($user->getPermissions()->standardModListUpdate);
+ $I->assertTrue($user->getPermissions()->standardModListCopy);
+ $I->assertTrue($user->getPermissions()->standardModListDelete);
+ $I->assertTrue($user->getPermissions()->standardModListApprove);
$I->assertSame('2020-01-01T00:00:00+00:00', $user->getCreatedAt()->format(DATE_ATOM));
$I->assertSame(null, $user->getCreatedBy()?->getId()->toString());
@@ -272,11 +272,11 @@ public function updateSelfAsAuthorizedUser(FunctionalTester $I): void
$I->assertTrue($user->getPermissions()->dlcDelete);
$I->assertTrue($user->getPermissions()->modListList);
- $I->assertTrue($user->getPermissions()->modListCreate);
- $I->assertTrue($user->getPermissions()->modListUpdate);
- $I->assertTrue($user->getPermissions()->modListCopy);
- $I->assertTrue($user->getPermissions()->modListDelete);
- $I->assertTrue($user->getPermissions()->modListApprove);
+ $I->assertTrue($user->getPermissions()->standardModListCreate);
+ $I->assertTrue($user->getPermissions()->standardModListUpdate);
+ $I->assertTrue($user->getPermissions()->standardModListCopy);
+ $I->assertTrue($user->getPermissions()->standardModListDelete);
+ $I->assertTrue($user->getPermissions()->standardModListApprove);
$I->assertSame('2020-01-01T00:00:00+00:00', $user->getCreatedAt()->format(DATE_ATOM));
$I->assertSame(null, $user->getCreatedBy()?->getId()->toString());
diff --git a/tests/functional/Users/Web/UserGroup/CreateUserGroupCest.php b/tests/functional/Users/Web/UserGroup/CreateUserGroupCest.php
index a2bac0e4..7ac94e9f 100644
--- a/tests/functional/Users/Web/UserGroup/CreateUserGroupCest.php
+++ b/tests/functional/Users/Web/UserGroup/CreateUserGroupCest.php
@@ -113,12 +113,15 @@ public function createUserGroupAsAuthorizedUser(FunctionalTester $I): void
$I->assertSame('7cb77e2f-c26e-4098-b47b-60539bf5bb70', $userGroup->getId()->toString());
$I->assertSame('All', $userGroup->getName());
$I->assertSame('All users', $userGroup->getDescription());
- $I->assertSame([
- AdminFixture::ID,
+
+ $groupUserIds = array_map(fn (User $user) => $user->getId()->toString(), $userGroup->getUsers());
+ $expectedGroupUserIds = [
User1Fixture::ID,
User2Fixture::ID,
User3Fixture::ID,
- ], array_map(fn (User $user) => $user->getId()->toString(), $userGroup->getUsers()));
+ AdminFixture::ID,
+ ];
+ $I->assertArraySame($expectedGroupUserIds, $groupUserIds);
$I->assertSame('805c9fcd-d674-4a27-8f0c-78dbf2484bb2', $userGroup->getPermissions()->getId()->toString());
@@ -148,11 +151,11 @@ public function createUserGroupAsAuthorizedUser(FunctionalTester $I): void
$I->assertTrue($userGroup->getPermissions()->dlcDelete);
$I->assertTrue($userGroup->getPermissions()->modListList);
- $I->assertTrue($userGroup->getPermissions()->modListCreate);
- $I->assertTrue($userGroup->getPermissions()->modListUpdate);
- $I->assertTrue($userGroup->getPermissions()->modListCopy);
- $I->assertTrue($userGroup->getPermissions()->modListDelete);
- $I->assertTrue($userGroup->getPermissions()->modListApprove);
+ $I->assertTrue($userGroup->getPermissions()->standardModListCreate);
+ $I->assertTrue($userGroup->getPermissions()->standardModListUpdate);
+ $I->assertTrue($userGroup->getPermissions()->standardModListCopy);
+ $I->assertTrue($userGroup->getPermissions()->standardModListDelete);
+ $I->assertTrue($userGroup->getPermissions()->standardModListApprove);
$I->assertSame('2020-01-01T00:00:00+00:00', $userGroup->getCreatedAt()->format(DATE_ATOM));
$I->assertSame($currentUser->getId()->toString(), $userGroup->getCreatedBy()?->getId()->toString());
diff --git a/tests/functional/Users/Web/UserGroup/UpdateUserGroupCest.php b/tests/functional/Users/Web/UserGroup/UpdateUserGroupCest.php
index 8e5d6060..51b96d0e 100644
--- a/tests/functional/Users/Web/UserGroup/UpdateUserGroupCest.php
+++ b/tests/functional/Users/Web/UserGroup/UpdateUserGroupCest.php
@@ -77,12 +77,15 @@ public function updateUserGroupAsAuthorizedUser(FunctionalTester $I): void
$userGroup = $I->grabEntityFromRepository(UserGroup::class, ['name' => 'All']);
$I->assertSame('All', $userGroup->getName());
$I->assertSame('All users', $userGroup->getDescription());
- $I->assertSame([
+
+ $groupUserIds = array_map(fn (User $user) => $user->getId()->toString(), $userGroup->getUsers());
+ $expectedGroupUserIds = [
User1Fixture::ID,
User2Fixture::ID,
User3Fixture::ID,
AdminFixture::ID,
- ], array_map(fn (User $user) => $user->getId()->toString(), $userGroup->getUsers()));
+ ];
+ $I->assertArraySame($expectedGroupUserIds, $groupUserIds);
$I->assertTrue($userGroup->getPermissions()->userList);
$I->assertFalse($userGroup->getPermissions()->userUpdate);
@@ -110,11 +113,11 @@ public function updateUserGroupAsAuthorizedUser(FunctionalTester $I): void
$I->assertFalse($userGroup->getPermissions()->dlcDelete);
$I->assertTrue($userGroup->getPermissions()->modListList);
- $I->assertFalse($userGroup->getPermissions()->modListCreate);
- $I->assertFalse($userGroup->getPermissions()->modListUpdate);
- $I->assertFalse($userGroup->getPermissions()->modListCopy);
- $I->assertFalse($userGroup->getPermissions()->modListDelete);
- $I->assertFalse($userGroup->getPermissions()->modListApprove);
+ $I->assertFalse($userGroup->getPermissions()->standardModListCreate);
+ $I->assertFalse($userGroup->getPermissions()->standardModListUpdate);
+ $I->assertFalse($userGroup->getPermissions()->standardModListCopy);
+ $I->assertFalse($userGroup->getPermissions()->standardModListDelete);
+ $I->assertFalse($userGroup->getPermissions()->standardModListApprove);
$I->assertSame('2020-01-01T00:00:00+00:00', $userGroup->getCreatedAt()->format(DATE_ATOM));
$I->assertSame(null, $userGroup->getCreatedBy()?->getId()->toString());
diff --git a/tests/unit/Shared/Service/Mission/MissionClientTest.php b/tests/unit/Shared/Service/Mission/MissionClientTest.php
index 19a9ed7f..f4b7aee4 100644
--- a/tests/unit/Shared/Service/Mission/MissionClientTest.php
+++ b/tests/unit/Shared/Service/Mission/MissionClientTest.php
@@ -89,7 +89,7 @@ public function provideGetCurrentMissionCases(): iterable
'closeDate' => $now->sub(new \DateInterval('P1D'))->format($dateFormat),
'description' => '',
'modlistName' => null,
- 'modlist' => 'https://armaforces.com/mod-list/Default2',
+ 'modlist' => 'https://armaforces.com/standard-mod-list/Default2',
'image' => '',
'freeSlots' => 0,
'allSlots' => 0,
diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml
index 21a86fef..8965042f 100644
--- a/translations/messages.pl.yaml
+++ b/translations/messages.pl.yaml
@@ -12,6 +12,7 @@ Mods: Mody
Mod groups: Grupy modów
DLCs: DLC
Mod lists: Listy modów
+External mod lists: Zewnętrzne listy modów
Today's mission: Dzisiejsza misja
Manage users: Zarządzaj użytkownikami
@@ -111,6 +112,10 @@ Can delete other users mod lists: Może usuwać listy modów innych użytkownik
'Note: User can always delete his own or assigned to him mod lists': 'Uwaga: Użytkownik zawsze ma możliwość usuwania stworzonych przez siebie lub przypisanych mu list modów'
Can approve mod lists: Może zatwierdzać listy modów
+Can create external mod lists: Może tworzyć zewnętrzne listy modów
+Can edit external mod lists: Może edytować zewnętrzne listy modów
+Can delete external mod lists: Może usuwać zewnętrzne listy modów
+
# Mods
Create mod: Utwórz mod
Edit mod: Edytuj mod
@@ -162,7 +167,9 @@ DLC directory: Katalog DLC
# Mod Lists
Download mod list: Pobierz listę modów
Create mod list: Utwórz listę modów
+Create external mod list: Utwórz zewnętrzną listę modów
Edit mod list: Edytuj listę modów
+Edit external mod list: Edytuj zewnętrzną listę modów
Copy and edit mod list: Kopiuj i edytuj listę modów
Delete mod list: Usuń listę modów
@@ -171,6 +178,8 @@ Mod list description: Opis
Mod list owner: Właściciel
Mod list active: Aktywna
Mod list approved: Zatwierdzona
+Mod list url: Link
+Mod list external: Zewnętrzna
# Mod Lists Customization
Mod list customization: Konfiguracja listy modów
|