Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt tests to core changes about AdminApi renaming #25

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/Integration/ApiPlatform/ApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ abstract class ApiTestCase extends SymfonyApiTestCase
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
self::updateConfiguration('PS_ADMIN_API_FORCE_DEBUG_SECURED', 0);
ApiClientResetter::resetApiClient();
}

public static function tearDownAfterClass(): void
{
parent::tearDownAfterClass();
ApiClientResetter::resetApiClient();
self::updateConfiguration('PS_ADMIN_API_FORCE_DEBUG_SECURED', 1);
self::$clientSecret = null;
}

Expand Down Expand Up @@ -258,5 +260,6 @@ protected static function addShop(string $shopName, int $shopGroupId, string $co
protected static function updateConfiguration(string $configurationKey, $value, ShopConstraint $shopConstraint = null): void
{
self::getContainer()->get(ShopConfigurationInterface::class)->set($configurationKey, $value, $shopConstraint ?: ShopConstraint::allShops());
\Configuration::resetStaticCache();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public static function setUpBeforeClass(): void
self::$frenchLangId = self::addLanguageByLocale('fr-FR');

self::updateConfiguration(MultistoreConfig::FEATURE_STATUS, 1);
// Disable secure protection for the tests (the configuration reset forced the default config back)
self::updateConfiguration('PS_ADMIN_API_FORCE_DEBUG_SECURED', 0);
self::$secondShopGroupId = self::addShopGroup('Second group');
self::$secondShopId = self::addShop('Second shop', self::DEFAULT_SHOP_GROUP_ID);
self::$thirdShopId = self::addShop('Third shop', self::$secondShopGroupId);
Expand All @@ -81,7 +83,7 @@ public static function setUpBeforeClass(): void
];

$featureFlagManager = self::getContainer()->get('PrestaShop\PrestaShop\Core\FeatureFlag\FeatureFlagManager');
$featureFlagManager->enable(FeatureFlagSettings::FEATURE_FLAG_AUTHORIZATION_SERVER_MULTISTORE);
$featureFlagManager->enable(FeatureFlagSettings::FEATURE_FLAG_ADMIN_API_MULTISTORE);
}

public function getProtectedEndpoints(): iterable
Expand Down
1 change: 0 additions & 1 deletion tests/Integration/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
define('_PS_ROOT_DIR_', dirname(__DIR__, 4));
}
define('_PS_IN_TEST_', true);
define('_PS_API_FORCE_TLS_VERSION_', false);
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_ . '/tests/Resources/modules/');
require_once _PS_ROOT_DIR_ . '/vendor/smarty/smarty/libs/functions.php';
require_once _PS_ROOT_DIR_ . '/admin-dev/bootstrap.php';
Expand Down
Loading