diff --git a/tests/Integration/ApiPlatform/ApiTestCase.php b/tests/Integration/ApiPlatform/ApiTestCase.php index 5f8292a..1f611e7 100644 --- a/tests/Integration/ApiPlatform/ApiTestCase.php +++ b/tests/Integration/ApiPlatform/ApiTestCase.php @@ -40,6 +40,7 @@ abstract class ApiTestCase extends SymfonyApiTestCase public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); + self::updateConfiguration('PS_ADMIN_API_FORCE_DEBUG_SECURED', 0); ApiClientResetter::resetApiClient(); } @@ -47,6 +48,7 @@ public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); ApiClientResetter::resetApiClient(); + self::updateConfiguration('PS_ADMIN_API_FORCE_DEBUG_SECURED', 1); self::$clientSecret = null; } @@ -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(); } } diff --git a/tests/Integration/ApiPlatform/ProductMultiShopEndpointTest.php b/tests/Integration/ApiPlatform/ProductMultiShopEndpointTest.php index 2ce91bf..c103bcb 100644 --- a/tests/Integration/ApiPlatform/ProductMultiShopEndpointTest.php +++ b/tests/Integration/ApiPlatform/ProductMultiShopEndpointTest.php @@ -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); @@ -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 diff --git a/tests/Integration/bootstrap.php b/tests/Integration/bootstrap.php index b068185..9106a53 100644 --- a/tests/Integration/bootstrap.php +++ b/tests/Integration/bootstrap.php @@ -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';