Initial commit: is_shoppingcart out of the box v3.0.1
This commit is contained in:
4
is_themecore/tests/.env.dist
Normal file
4
is_themecore/tests/.env.dist
Normal file
@ -0,0 +1,4 @@
|
||||
PHP71_EXEC_PATH="/usr/bin/php7.1"
|
||||
PHP72_EXEC_PATH="/usr/bin/php7.2"
|
||||
PHP73_EXEC_PATH="/usr/bin/php7.3"
|
||||
PHP74_EXEC_PATH="/usr/bin/php7.4"
|
||||
45
is_themecore/tests/grumphp.dist.yml
Normal file
45
is_themecore/tests/grumphp.dist.yml
Normal file
@ -0,0 +1,45 @@
|
||||
grumphp:
|
||||
tasks:
|
||||
php71:
|
||||
metadata:
|
||||
task: shell
|
||||
scripts:
|
||||
- ["-c", "tests/php/php_syntax.sh $PHP71_EXEC_PATH"]
|
||||
php72:
|
||||
metadata:
|
||||
task: shell
|
||||
scripts:
|
||||
- ["-c", "tests/php/php_syntax.sh $PHP72_EXEC_PATH"]
|
||||
php73:
|
||||
metadata:
|
||||
task: shell
|
||||
scripts:
|
||||
- ["-c", "tests/php/php_syntax.sh $PHP73_EXEC_PATH"]
|
||||
php74:
|
||||
metadata:
|
||||
task: shell
|
||||
scripts:
|
||||
- ["-c", "tests/php/php_syntax.sh $PHP74_EXEC_PATH"]
|
||||
phpcsfixer:
|
||||
config: tests/php/.php-cs-fixer.dist.php
|
||||
phpstan:
|
||||
configuration: tests/php/phpstan.dist.neon
|
||||
eslint:
|
||||
bin: _dev/node_modules/.bin/eslint
|
||||
config: _dev/.eslintrc.js
|
||||
header-stamp:
|
||||
metadata:
|
||||
task: shell
|
||||
scripts:
|
||||
- [
|
||||
"-c",
|
||||
'vendor/bin/header-stamp --dry-run
|
||||
--extensions="php,js,css,scss,tpl,html.twig,vue" --exclude="vendor,node_modules" --license="_dev/header-stamp/afl.txt"',
|
||||
]
|
||||
fixer:
|
||||
fix_by_default: true
|
||||
environment:
|
||||
files:
|
||||
- tests/.env.dist
|
||||
- tests/.env
|
||||
|
||||
14
is_themecore/tests/php/.php-cs-fixer.dist.php
Normal file
14
is_themecore/tests/php/.php-cs-fixer.dist.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$rootDir = __DIR__ . '/../../';
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->in($rootDir)
|
||||
->exclude(['vendor', 'node_modules'])
|
||||
;
|
||||
|
||||
$config = new PrestaShop\CodingStandards\CsFixer\Config();
|
||||
return $config
|
||||
->setUsingCache(true)
|
||||
->setCacheFile(__DIR__.'/.php-cs-fixer.cache')
|
||||
->setFinder($finder)
|
||||
;
|
||||
3
is_themecore/tests/php/.phpstan_bootstrap.neon
Normal file
3
is_themecore/tests/php/.phpstan_bootstrap.neon
Normal file
@ -0,0 +1,3 @@
|
||||
parameters:
|
||||
bootstrapFiles:
|
||||
- %currentWorkingDirectory%/tests/php/.phpstan_bootstrap.php
|
||||
70
is_themecore/tests/php/.phpstan_bootstrap.php
Normal file
70
is_themecore/tests/php/.phpstan_bootstrap.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
define('DEFAULT_PATH_TO_PRESTASHOP', '/path/to/prestashop/');
|
||||
define('PHPSTAN_PS_ROOT_CONFIG_FILE', __DIR__ . '/.phpstan_bootstrap_config.php');
|
||||
|
||||
try {
|
||||
if(!include_env_configuration()) {
|
||||
create_default_config_file_and_exit();
|
||||
}
|
||||
|
||||
abort_on_incorrect_configuration();
|
||||
|
||||
echo 'Phpstan configuration : _PS_ROOT_DIR_ successfully set to ' . getenv('_PS_ROOT_DIR_');
|
||||
} catch (RuntimeException $exception) {
|
||||
echo PHP_EOL . ' Phpstan configuration problem : ' . $exception->getMessage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// ----------- end of script -------------
|
||||
|
||||
function include_env_configuration(): bool
|
||||
{
|
||||
if (file_exists(PHPSTAN_PS_ROOT_CONFIG_FILE)) {
|
||||
require PHPSTAN_PS_ROOT_CONFIG_FILE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function create_default_config_file_and_exit(): void
|
||||
{
|
||||
if (!getenv('_PS_ROOT_DIR_')) {
|
||||
echo 'Environment variable _PS_ROOT_DIR_ not set.' . PHP_EOL;
|
||||
|
||||
// check if config file exists and create a default one if needed.
|
||||
if (!file_exists(PHPSTAN_PS_ROOT_CONFIG_FILE)) {
|
||||
file_put_contents(PHPSTAN_PS_ROOT_CONFIG_FILE,
|
||||
'<?php' . PHP_EOL .
|
||||
'// replace ' . DEFAULT_PATH_TO_PRESTASHOP . ' with a local path.' . PHP_EOL .
|
||||
'putenv(\'_PS_ROOT_DIR_=' . DEFAULT_PATH_TO_PRESTASHOP . '\');');
|
||||
|
||||
throw new RuntimeException(PHP_EOL . PHP_EOL . ' Missing phpstan configuration file.' . PHP_EOL . ' Default file created. Edit file "' . PHPSTAN_PS_ROOT_CONFIG_FILE . '"' . PHP_EOL . PHP_EOL);
|
||||
}
|
||||
|
||||
throw new RuntimeException(PHP_EOL . ' Configuration file was found but _PS_ROOT_DIR_ is still not set.' . PHP_EOL . ' Edit or remove PHPSTAN_PS_ROOT_CONFIG_FILE to define a _PS_ROOT_DIR_ (using putenv()).');
|
||||
}
|
||||
}
|
||||
|
||||
function abort_on_incorrect_configuration(): void
|
||||
{
|
||||
// envirornnemt var not set
|
||||
if (false === getenv('_PS_ROOT_DIR_')) {
|
||||
throw new RuntimeException(PHP_EOL . PHP_EOL . ' _PS_ROOT_DIR_ not set on "' . PHPSTAN_PS_ROOT_CONFIG_FILE . PHP_EOL . ' Correct this file or delete it. ');
|
||||
}
|
||||
|
||||
// default path was left
|
||||
if (DEFAULT_PATH_TO_PRESTASHOP === getenv('_PS_ROOT_DIR_')) {
|
||||
throw new RuntimeException(PHP_EOL . PHP_EOL . ' You must configure the path to Prestashop in "' . PHPSTAN_PS_ROOT_CONFIG_FILE . PHP_EOL . ' You left the default value.' . PHP_EOL);
|
||||
}
|
||||
|
||||
// abort if _PS_ROOT_DIR_ is not a valid path
|
||||
if (!file_exists(getenv('_PS_ROOT_DIR_'))) {
|
||||
throw new RuntimeException(PHP_EOL . PHP_EOL . ' Invalid path to prestashop. Provided : ' . getenv('_PS_ROOT_DIR_') . PHP_EOL . ' Edit "' . PHPSTAN_PS_ROOT_CONFIG_FILE . '" and modify _PS_ROOT_DIR_ ');
|
||||
}
|
||||
}
|
||||
1
is_themecore/tests/php/php_syntax.sh
Normal file
1
is_themecore/tests/php/php_syntax.sh
Normal file
@ -0,0 +1 @@
|
||||
find . -type f -name '*.php' ! -path "./vendor/*" ! -path "./tests/*" -exec $1 -l -n {} \; 2>&1 | (! grep -v "No syntax errors detected")
|
||||
14
is_themecore/tests/php/phpstan.dist.neon
Normal file
14
is_themecore/tests/php/phpstan.dist.neon
Normal file
@ -0,0 +1,14 @@
|
||||
parameters:
|
||||
paths:
|
||||
# We consider that the extension file will be stored the folder test/phpstan
|
||||
# From Phpstan 0.12, paths are relative to the .neon file.
|
||||
- ../../src
|
||||
- ../../is_themecore.php
|
||||
ignoreErrors:
|
||||
# - "#Insert your error here (don't forget to escape special characters like the following hash: \\#)#"
|
||||
reportUnmatchedIgnoredErrors: true
|
||||
level: 9
|
||||
|
||||
includes:
|
||||
- %currentWorkingDirectory%/tests/php/.phpstan_bootstrap.neon
|
||||
- %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon
|
||||
Reference in New Issue
Block a user