Unverified Commit ef3c3ef1 authored by Matthieu Rolland's avatar Matthieu Rolland Committed by GitHub
Browse files

Merge pull request #24729 from atomiix/update-linklist

Update linklist to v4
parents 94756fe4 99699c4a
......@@ -182,8 +182,9 @@ class AppKernel extends Kernel
*/
private function enableComposerAutoloaderOnModules($modules)
{
$moduleDirectoryPath = rtrim(_PS_MODULE_DIR_, '/') . '/';
foreach ($modules as $module) {
$autoloader = __DIR__ . '/../modules/' . $module . '/vendor/autoload.php';
$autoloader = $moduleDirectoryPath . $module . '/vendor/autoload.php';
if (file_exists($autoloader)) {
include_once $autoloader;
......
......@@ -72,7 +72,7 @@
"prestashop/ps_featuredproducts": "^2",
"prestashop/ps_imageslider": "^3",
"prestashop/ps_languageselector": "^2",
"prestashop/ps_linklist": "^3",
"prestashop/ps_linklist": "^4",
"prestashop/ps_mainmenu": "^2",
"prestashop/ps_searchbar": "~2.0.0",
"prestashop/ps_sharebuttons": "^2",
......@@ -189,6 +189,7 @@
"@php -d date.timezone=UTC ./vendor/bin/phpunit -c tests-legacy/phpunit.xml"
],
"phpunit-endpoints": [
"@composer create-test-db",
"@php -d date.timezone=UTC ./vendor/bin/phpunit -c tests-legacy/phpunit-endpoints.xml"
],
"unit-tests": [
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "59789cac67e25b35069b440c08f670f2",
"content-hash": "d698ef2f1842f6818749a2ee8ee00d1a",
"packages": [
{
"name": "beberlei/doctrineextensions",
......@@ -4937,16 +4937,16 @@
},
{
"name": "prestashop/ps_linklist",
"version": "v3.2.0",
"version": "v4.0.0",
"source": {
"type": "git",
"url": "https://github.com/PrestaShop/ps_linklist.git",
"reference": "4abf07d4ee2b007df78849fc9475c2dcab087a69"
"reference": "3072601605c569e7aa3565a6d57e7bae56428b00"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PrestaShop/ps_linklist/zipball/4abf07d4ee2b007df78849fc9475c2dcab087a69",
"reference": "4abf07d4ee2b007df78849fc9475c2dcab087a69",
"url": "https://api.github.com/repos/PrestaShop/ps_linklist/zipball/3072601605c569e7aa3565a6d57e7bae56428b00",
"reference": "3072601605c569e7aa3565a6d57e7bae56428b00",
"shasum": ""
},
"require": {
......@@ -4978,10 +4978,9 @@
"description": "PrestaShop - Link list",
"homepage": "https://github.com/PrestaShop/ps_linklist",
"support": {
"issues": "https://github.com/PrestaShop/ps_linklist/issues",
"source": "https://github.com/PrestaShop/ps_linklist/tree/master"
"source": "https://github.com/PrestaShop/ps_linklist/tree/v4.0.0"
},
"time": "2020-07-10T07:10:55+00:00"
"time": "2021-02-11T15:55:29+00:00"
},
{
"name": "prestashop/ps_mainmenu",
......
......@@ -251,8 +251,7 @@ class ModuleTabRegister
*/
protected function getModuleAdminControllers($moduleName)
{
$modulePath = _PS_ROOT_DIR_ . '/' . basename(_PS_MODULE_DIR_) .
'/' . $moduleName . '/controllers/admin/';
$modulePath = rtrim(_PS_MODULE_DIR_, '/') . '/' . $moduleName . '/controllers/admin/';
if (!$this->filesystem->exists($modulePath)) {
return [];
......@@ -280,9 +279,7 @@ class ModuleTabRegister
*/
protected function getModuleControllersFromRouting(string $moduleName): array
{
$routingFile = _PS_ROOT_DIR_ . '/' . basename(_PS_MODULE_DIR_) .
'/' . $moduleName . '/config/routes.yml';
$routingFile = rtrim(_PS_MODULE_DIR_, '/') . '/' . $moduleName . '/config/routes.yml';
if (!$this->filesystem->exists($routingFile)) {
return [];
}
......
......@@ -280,8 +280,8 @@ namespace PrestaShopBundle\Install {
if (!defined('_PS_TRANSLATIONS_DIR_')) {
define('_PS_TRANSLATIONS_DIR_', _PS_ROOT_DIR_ . '/translations/');
}
if (!defined('_PS_MODULES_DIR_')) {
define('_PS_MODULES_DIR_', _PS_ROOT_DIR_ . '/modules/');
if (!defined('_PS_MODULE_DIR_')) {
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_ . '/modules/');
}
if (!defined('_PS_MAILS_DIR_')) {
define('_PS_MAILS_DIR_', _PS_ROOT_DIR_ . '/mails/');
......
......@@ -84,7 +84,7 @@ final class ModuleRepository
{
if (null === $this->activeModulesPaths) {
$this->activeModulesPaths = [];
$modulesFiles = Finder::create()->directories()->in(__DIR__ . '/../../../modules')->depth(0);
$modulesFiles = Finder::create()->directories()->in(_PS_MODULE_DIR_)->depth(0);
$activeModules = $this->getActiveModules();
foreach ($modulesFiles as $moduleFile) {
......
......@@ -26,10 +26,13 @@
namespace LegacyTests\Endpoints;
use Tools;
use AppKernel;
use Cache;
use Context;
use Employee;
use EmployeeSession;
use Shop;
use PhpEncryption;
use PrestaShop\PrestaShop\Adapter\SymfonyContainer;
use ReflectionClass;
......@@ -38,21 +41,42 @@ abstract class AbstractEndpointAdminTest extends AbstractEndpointTest
{
protected function setUp()
{
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
parent::setUp();
$this->initContainerInstance();
if (!defined('_PS_TAB_MODULE_LIST_URL_')) {
define('_PS_TAB_MODULE_LIST_URL_', '');
}
Shop::initialize();
Context::getContext()->employee = new Employee(1);
}
protected function employeeLogin()
{
$cipherTool = new PhpEncryption(_NEW_COOKIE_KEY_);
$cookieContent = 'id_employee|1¤';
// Create Employee Session to be sure the user is connected
$session = new EmployeeSession();
$session->setUserId(1);
$session->setToken(sha1(time() . uniqid()));
$session->add();
$cookieContent = 'id_employee|1¤session_id|' . $session->getId() . '¤session_token|' . $session->getToken() . '¤';
$cookieContent .= 'checksum|' . hash('sha256', _COOKIE_IV_ . $cookieContent);
$cookieName = 'PrestaShop-' . md5(_PS_VERSION_ . 'psAdmin');
// Reproduce Cookie::getDomain behavior
$httpHost = Tools::getHttpHost(false, false);
if (!strstr($httpHost, '.')) {
$httpHost = false;
}
$cookieName = 'PrestaShop-' . md5(_PS_VERSION_ . 'psAdmin' . $httpHost);
$_COOKIE[$cookieName] = $cipherTool->encrypt($cookieContent);
Cache::store('isLoggedBack' . 1, true);
}
......
......@@ -40,7 +40,6 @@ abstract class AbstractEndpointTest extends TestCase
{
define('_PS_ROOT_DIR_', __DIR__ . '/../..');
define('_PS_ADMIN_DIR_', _PS_ROOT_DIR_ . '/admin-dev');
//define('_DB_PREFIX_', 'ps_');
require_once _PS_ROOT_DIR_ . '/config/defines.inc.php';
require_once _PS_CONFIG_DIR_ . 'autoload.php';
require_once _PS_CONFIG_DIR_ . 'bootstrap.php';
......
......@@ -41,7 +41,7 @@ class DatabaseCreator
define('_PS_IN_TEST_', true);
define('__PS_BASE_URI__', '/');
define('_PS_ROOT_DIR_', __DIR__ . '/../../..');
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_ . '/tests-legacy/resources/modules/');
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_ . '/modules/');
require_once __DIR__ . '/../../../install-dev/init.php';
$install = new Install();
......
......@@ -28,6 +28,7 @@ namespace Tests\Integration\Behaviour\Features\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\TableNode;
use Cache;
use Cart;
use Combination;
use Configuration;
......@@ -257,6 +258,10 @@ class ProductFeatureContext extends AbstractPrestaShopFeatureContext
// Fix issue pack cache is set when adding products.
Pack::resetStaticCache();
// Fix issue related to modules hooked on `actionProductSave` and calling `Product::priceCalculation()`
// leading to cache issues later
Product::resetStaticCache();
Cache::clear();
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment