Skip to content

Commit a07bea1

Browse files
authored
Merge pull request #180 from PrestaShop/dev
Release v6.0.0
2 parents 682944c + 8d82f07 commit a07bea1

20 files changed

Lines changed: 218 additions & 129 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Add Issue to Project
2+
3+
on:
4+
issues:
5+
types: [ opened ]
6+
7+
jobs:
8+
add-to-project:
9+
uses: PrestaShop/.github/.github/workflows/reusable-add-to-project.yml@master
10+
with:
11+
project-number: 47
12+
secrets:
13+
TOKEN: ${{ secrets.JARVIS_TOKEN }}

.github/workflows/php.yml

Lines changed: 84 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
name: PHP tests
22
on: [push, pull_request]
33
jobs:
4-
# Check there is no syntax errors in the project
54
php-linter:
6-
name: PHP Syntax check 7.1 => 8.1
5+
name: PHP Syntax check
76
runs-on: ubuntu-latest
87
steps:
98
- name: Checkout
10-
uses: actions/checkout@v3.1.0
11-
12-
- name: PHP syntax checker 7.1
13-
uses: prestashop/github-action-php-lint/7.1@master
9+
uses: actions/checkout@v6
1410

1511
- name: PHP syntax checker 7.2
1612
uses: prestashop/github-action-php-lint/7.2@master
@@ -27,63 +23,101 @@ jobs:
2723
- name: PHP syntax checker 8.1
2824
uses: prestashop/github-action-php-lint/8.1@master
2925

26+
- name: PHP syntax checker 8.2
27+
uses: prestashop/github-action-php-lint/8.2@master
28+
29+
- name: PHP syntax checker 8.3
30+
uses: prestashop/github-action-php-lint/8.3@master
31+
32+
- name: PHP syntax checker 8.4
33+
uses: prestashop/github-action-php-lint/8.4@master
34+
35+
- name: PHP syntax checker 8.5
36+
uses: prestashop/github-action-php-lint/8.5@master
37+
3038
# Check the PHP code follow the coding standards
3139
php-cs-fixer:
3240
name: PHP-CS-Fixer
3341
runs-on: ubuntu-latest
3442
steps:
35-
- name: Setup PHP
36-
uses: shivammathur/setup-php@v2
43+
- name: Run PHP-CS-Fixer
44+
uses: PrestaShop/.github/.github/actions/php-ci/php-cs@master
3745
with:
3846
php-version: '7.4'
3947

40-
- name: Checkout
41-
uses: actions/checkout@v3.1.0
42-
43-
- name: Cache dependencies
44-
uses: actions/cache@v3
48+
# Run PHPStan against the module (PHP 7.4 – 8.1)
49+
phpstan-74:
50+
name: PHPStan (PHP 7.4 - 8.1)
51+
runs-on: ubuntu-latest
52+
strategy:
53+
matrix:
54+
presta_version: ['8.2.x']
55+
php_version: ['7.4', '8.1']
56+
fail-fast: false
57+
env:
58+
PHPRC: ${{ github.workspace }}/${{ github.event.repository.name }}/.phpstan-php-ini
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v6
4562
with:
46-
path: vendor
47-
key: php-${{ hashFiles('composer.lock') }}
48-
49-
- name: Install dependencies
50-
run: composer install
51-
52-
- name: Run PHP-CS-Fixer
53-
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no --diff-format udiff
54-
55-
# Run PHPStan against the module and a PrestaShop release
63+
path: ${{ github.event.repository.name }}
64+
65+
- name: Prepare PHP env for PrestaShop 8 (define constants before any bootstrap)
66+
run: |
67+
mkdir -p ${{ github.event.repository.name }}/.phpstan-php-ini
68+
{
69+
echo "auto_prepend_file=$GITHUB_WORKSPACE/${{ github.event.repository.name }}/tests/php/phpstan/prepend-constants.php"
70+
echo "memory_limit=512M"
71+
} > ${{ github.event.repository.name }}/.phpstan-php-ini/php.ini
72+
73+
- name: Run PHPStan
74+
uses: PrestaShop/.github/.github/actions/php-ci/phpstan@master
75+
with:
76+
php-version: ${{ matrix.php_version }}
77+
presta-version: ${{ matrix.presta_version }}
78+
module-name: ${{ github.event.repository.name }}
79+
phpstan-level: '5'
80+
phpstan-config: tests/php/phpstan/phpstan-${{ matrix.presta_version }}.neon
81+
phpstan-version: '^0.12'
82+
composer-version: '2.2.18'
83+
84+
# Run PHPStan against the module (PHP 8.1 – 8.5)
5685
phpstan:
57-
name: PHPStan
86+
name: PHPStan (PHP 8.1 - 8.5)
5887
runs-on: ubuntu-latest
5988
strategy:
6089
matrix:
61-
presta-versions: ['1.7.7', '1.7.8', '8.0', 'latest']
90+
include:
91+
# PrestaShop 9.0.x supports PHP 8.1 up to 8.4 (8.5 is not supported)
92+
- { presta_version: '9.0.3', php_version: '8.1' }
93+
- { presta_version: '9.0.3', php_version: '8.4' }
94+
# PrestaShop 9.1.x and develop support PHP 8.1 up to 8.5
95+
- { presta_version: '9.1.x', php_version: '8.1' }
96+
- { presta_version: '9.1.x', php_version: '8.5' }
97+
- { presta_version: 'develop', php_version: '8.1' }
98+
- { presta_version: 'develop', php_version: '8.5' }
99+
fail-fast: false
100+
env:
101+
PHPRC: ${{ github.workspace }}/${{ github.event.repository.name }}/.phpstan-php-ini
62102
steps:
63-
- name: Setup PHP
64-
uses: shivammathur/setup-php@v2
65-
with:
66-
php-version: '7.4'
67-
68-
- name: Checkout
69-
uses: actions/checkout@v3.1.0
70-
71-
# Add vendor folder in cache to make next builds faster
72-
- name: Cache vendor folder
73-
uses: actions/cache@v3
103+
- name: Checkout repository
104+
uses: actions/checkout@v6
74105
with:
75-
path: vendor
76-
key: php-${{ hashFiles('composer.lock') }}
77-
78-
# Add composer local folder in cache to make next builds faster
79-
- name: Cache composer folder
80-
uses: actions/cache@v3
106+
path: ${{ github.event.repository.name }}
107+
108+
- name: Prepare PHP env for PrestaShop ${{ matrix.presta_version }} (define constants before any bootstrap)
109+
run: |
110+
mkdir -p ${{ github.event.repository.name }}/.phpstan-php-ini
111+
{
112+
echo "auto_prepend_file=$GITHUB_WORKSPACE/${{ github.event.repository.name }}/tests/php/phpstan/prepend-constants.php"
113+
echo "memory_limit=512M"
114+
} > ${{ github.event.repository.name }}/.phpstan-php-ini/php.ini
115+
116+
- name: Run PHPStan
117+
uses: PrestaShop/.github/.github/actions/php-ci/phpstan@master
81118
with:
82-
path: ~/.composer/cache
83-
key: php-composer-cache
84-
85-
- run: composer install
86-
87-
# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled
88-
- name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }})
89-
run: ./tests/phpstan.sh ${{ matrix.presta-versions }}
119+
php-version: ${{ matrix.php_version }}
120+
presta-version: ${{ matrix.presta_version }}
121+
module-name: ${{ github.event.repository.name }}
122+
phpstan-level: '5'
123+
phpstan-config: tests/php/phpstan/phpstan-${{ matrix.presta_version }}.neon

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To use it, you will need to create a Google Analytics account and insert your Go
88

99
## Compatibility
1010

11-
PrestaShop: `1.7.7.0` or later
11+
PrestaShop: `8.2.0` or later
1212

1313
### Notes
1414

classes/Hook/HookDisplayBeforeBodyClosingTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private function renderSearch()
140140
/**
141141
* This method renders tracking code for product listings, like category pages.
142142
*/
143-
private function renderCartpage()
143+
private function renderCartPage()
144144
{
145145
// Check if we are on cart page
146146
if ($this->context->controller->php_self != 'cart') {

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module>
33
<name>ps_googleanalytics</name>
44
<displayName><![CDATA[Google Analytics]]></displayName>
5-
<version><![CDATA[5.0.3]]></version>
5+
<version><![CDATA[6.0.0]]></version>
66
<description><![CDATA[Gain clear insights into important metrics about your customers, using Google Analytics]]></description>
77
<author><![CDATA[PrestaShop]]></author>
88
<tab><![CDATA[analytics_stats]]></tab>

ps_googleanalytics.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public function __construct()
4747
{
4848
$this->name = 'ps_googleanalytics';
4949
$this->tab = 'analytics_stats';
50-
$this->version = '5.0.3';
51-
$this->ps_versions_compliancy = ['min' => '1.7.7', 'max' => _PS_VERSION_];
50+
$this->version = '6.0.0';
51+
$this->ps_versions_compliancy = ['min' => '8.2.0', 'max' => _PS_VERSION_];
5252
$this->author = 'PrestaShop';
5353
$this->module_key = 'fd2aaefea84ac1bb512e6f1878d990b8';
5454
$this->bootstrap = true;
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
<?php
22
/**
3-
* Copyright since 2007 PrestaShop SA and Contributors
3+
* 2007-2020 PrestaShop SA and Contributors
44
*
55
* NOTICE OF LICENSE
66
*
77
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
8-
* that is bundled with this package in the file LICENSE.md.
8+
* that is bundled with this package in the file LICENSE.txt.
99
* It is also available through the world-wide-web at this URL:
1010
* https://opensource.org/licenses/AFL-3.0
1111
* If you did not receive a copy of the license and are unable to
1212
* obtain it through the world-wide-web, please send an email
1313
* to license@prestashop.com so we can send you a copy immediately.
1414
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to https://www.prestashop.com for more information.
20+
*
1521
* @author PrestaShop SA <contact@prestashop.com>
16-
* @copyright Since 2007 PrestaShop SA and Contributors
22+
* @copyright 2007-2020 PrestaShop SA and Contributors
1723
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
1824
* International Registered Trademark & Property of PrestaShop SA
1925
*/

tests/php/phpstan/index.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* 2007-2020 PrestaShop SA and Contributors
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* https://opensource.org/licenses/AFL-3.0
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to https://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <contact@prestashop.com>
22+
* @copyright 2007-2020 PrestaShop SA and Contributors
23+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
27+
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
28+
29+
header('Cache-Control: no-store, no-cache, must-revalidate');
30+
header('Cache-Control: post-check=0, pre-check=0', false);
31+
header('Pragma: no-cache');
32+
33+
header('Location: ../');
34+
exit;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
includes:
2+
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
3+
4+
parameters:
5+
ignoreErrors:
6+
# Framework / structural limitations that cannot be fixed in module code:
7+
# - uninstallModule() calls parent::uninstall() through a closure rebound to the
8+
# target module via Closure::bindTo(), a pattern PHPStan cannot statically resolve.
9+
# - Cookie uses magic __get/__set, so its dynamic properties are undefined to PHPStan.
10+
# - HookInterface mandates the constructor signature (Ps_Googleanalytics $module, Context),
11+
# so $module must be stored even in hooks that never read it back.
12+
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
13+
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
14+
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'
15+
- '#Property PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookActionValidateOrder::\$module is never read, only written\.#'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
includes:
2+
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
3+
4+
parameters:
5+
ignoreErrors:
6+
# Framework / structural limitations that cannot be fixed in module code:
7+
# - uninstallModule() calls parent::uninstall() through a closure rebound to the
8+
# target module via Closure::bindTo(), a pattern PHPStan cannot statically resolve.
9+
# - Cookie uses magic __get/__set, so its dynamic properties are undefined to PHPStan.
10+
# - HookInterface mandates the constructor signature (Ps_Googleanalytics $module, Context),
11+
# so $module must be stored even in hooks that never read it back.
12+
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
13+
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
14+
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'
15+
- '#Property PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookActionValidateOrder::\$module is never read, only written\.#'

0 commit comments

Comments
 (0)