diff --git a/composer.lock b/composer.lock index c69d46982..f332de946 100644 --- a/composer.lock +++ b/composer.lock @@ -708,17 +708,22 @@ "source": { "type": "git", "url": "https://github.com/PrestaShopCorp/lightweight-container.git", - "reference": "864578853c19d3c18728d5ccf3e4d2e98141a3de" + "reference": "d8fc064dc024515a0722cc2a0f834657faed5e79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PrestaShopCorp/lightweight-container/zipball/864578853c19d3c18728d5ccf3e4d2e98141a3de", - "reference": "864578853c19d3c18728d5ccf3e4d2e98141a3de", + "url": "https://api.github.com/repos/PrestaShopCorp/lightweight-container/zipball/d8fc064dc024515a0722cc2a0f834657faed5e79", + "reference": "d8fc064dc024515a0722cc2a0f834657faed5e79", "shasum": "" }, "require": { "php": ">=5.6" }, + "require-dev": { + "phpstan/phpstan": "^1.7", + "phpunit/phpunit": "^8.0 || ^9.0", + "prestashop/php-dev-tools": "^4.2" + }, "default-branch": true, "type": "library", "autoload": { @@ -726,6 +731,25 @@ "PrestaShopCorp\\LightweightContainer\\": "src/" } }, + "autoload-dev": { + "psr-4": { + "PrestaShopCorp\\LightweightContainer\\Test\\": "tests/src/" + } + }, + "scripts": { + "phpunit": [ + "./vendor/bin/phpunit --coverage-text" + ], + "php-cs-fixer": [ + "./vendor/bin/php-cs-fixer fix --config .php_cs.dist.php --diff" + ], + "header-stamp": [ + "./vendor/bin/header-stamp --target=\".\" --license=./vendor/prestashop/header-stamp/assets/afl.txt --exclude=.github,vendor,tests" + ] + }, + "license": [ + "AFL-3.0" + ], "authors": [ { "name": "hschoenenberger", @@ -737,7 +761,7 @@ "source": "https://github.com/PrestaShopCorp/lightweight-container/tree/main", "issues": "https://github.com/PrestaShopCorp/lightweight-container/issues" }, - "time": "2024-11-27T13:13:53+00:00" + "time": "2024-12-19T09:21:36+00:00" }, { "name": "prestashopcorp/oauth2-prestashop", diff --git a/config.preprod.php b/config.preprod.php index 37f9b82de..ee414b1e0 100644 --- a/config.preprod.php +++ b/config.preprod.php @@ -46,5 +46,5 @@ 'ps_accounts.testimonials_url' => 'https://assets.prestashop3.com/dst/accounts/assets/testimonials.json', - 'ps_accounts.log_level' => 'DEBUG', + 'ps_accounts.log_level' => 'INFO', ]; diff --git a/ps_accounts.php b/ps_accounts.php index 830f87432..9ae6b3497 100644 --- a/ps_accounts.php +++ b/ps_accounts.php @@ -236,9 +236,9 @@ public function getCoreServiceContainer() public function getServiceContainer() { if (null === $this->moduleContainer) { - $this->moduleContainer = \PrestaShop\Module\PsAccounts\ServiceContainer\PsAccountsContainer::createInstance( + $this->moduleContainer = (new \PrestaShop\Module\PsAccounts\ServiceContainer\PsAccountsContainer( __DIR__ . '/config.php' - ); + ))->init(); } return $this->moduleContainer; @@ -308,25 +308,26 @@ public function getCustomHooks() * @param array $customHooks * * @return bool - * - * @throws PrestaShopDatabaseException - * @throws PrestaShopException */ public function addCustomHooks($customHooks) { $ret = true; - foreach ($customHooks as $customHook) { - $verify = true; - if ((bool) Hook::getIdByName($customHook['name']) === false) { - $hook = new Hook(); - $hook->name = $customHook['name']; - $hook->title = $customHook['title']; - $hook->description = $customHook['description']; - $hook->position = $customHook['position']; - $verify = $hook->add(); // return true on success + try { + $verify = true; + if ((bool) Hook::getIdByName($customHook['name']) === false) { + $hook = new Hook(); + $hook->name = $customHook['name']; + $hook->title = $customHook['title']; + $hook->description = $customHook['description']; + $hook->position = $customHook['position']; + $verify = $hook->add(); // return true on success + } + $ret = $ret && $verify; + } catch (\Throwable $e) { + /* @phpstan-ignore-next-line */ + } catch (\Exception $e) { } - $ret = $ret && $verify; } return $ret;