Skip to content

Commit d8da9fe

Browse files
authored
[TASK] Introduce runTest.sh for unified testing. (#521)
Manual backport to 12.4 needed Releases: main, 13.4, 12.4
1 parent 56a04d0 commit d8da9fe

File tree

8 files changed

+722
-37
lines changed

8 files changed

+722
-37
lines changed

.github/workflows/tests.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
1-
name: Tests
1+
name: tests
22

3-
on: [ push, pull_request ]
3+
on:
4+
push:
5+
pull_request:
46

57
jobs:
68
lint:
7-
name: Lint PHP files
9+
name: Linting
810
runs-on: ubuntu-latest
911
strategy:
1012
matrix:
1113
php:
1214
- '8.2'
1315
- '8.3'
16+
- '8.4'
1417
steps:
1518
- name: Checkout
1619
uses: actions/checkout@v4
1720

18-
- name: Setup PHP version
19-
uses: shivammathur/setup-php@v2
20-
with:
21-
php-version: ${{ matrix.php-versions }}
22-
2321
- name: Lint PHP
24-
run: find . -type f -name '*.php' ! -path "./.Build/*" -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" )
22+
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lint
2523

26-
code-quality:
27-
name: Code quality
24+
quality:
25+
name: Quality
2826
runs-on: ubuntu-latest
2927
env:
3028
php: '8.2'
3129
steps:
3230
- name: Checkout
3331
uses: actions/checkout@v4
3432

35-
- name: Setup PHP version
36-
uses: shivammathur/setup-php@v2
37-
with:
38-
php-version: ${{ matrix.php-versions }}
39-
4033
- name: Install testing system
41-
run: composer update --no-progress --prefer-dist --optimize-autoloader
34+
run: Build/Scripts/runTests.sh -p ${{ env.php }} -s composerUpdate
35+
36+
- name: Composer validate
37+
run: Build/Scripts/runTests.sh -p ${{ env.php }} -s composerValidate
38+
39+
- name: Composer normalize
40+
run: Build/Scripts/runTests.sh -p ${{ env.php }} -s composerNormalize -n
41+
42+
- name: CGL
43+
run: Build/Scripts/runTests.sh -n -p ${{ env.php }} -s cgl -n
44+
45+
- name: Check Rst
46+
run: Build/Scripts/runTests.sh -p ${{ env.php }} -s checkRst
4247

43-
- name: Check PHP coding standards
44-
run: |
45-
make check-php
48+
- name: Lint YAML
49+
run: Build/Scripts/runTests.sh -p ${{ env.php }} -s yamlLint

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
composer.lock
2424
nbproject
2525
Documentation-GENERATED-temp/
26+
/composer.json.testing
27+
/.Build/

Build/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testing-docker/.env

Build/.php-cs-fixer.dist.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Finder;
7+
8+
return (new Config())
9+
->setFinder(
10+
(new Finder())
11+
->in(__DIR__.'/../Documentation')
12+
)
13+
->setRiskyAllowed(true)
14+
->setRules([
15+
'@DoctrineAnnotation' => true,
16+
// @todo: Switch to @PER-CS2.0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247
17+
'@PER-CS1.0' => true,
18+
'array_indentation' => true,
19+
'array_syntax' => ['syntax' => 'short'],
20+
'cast_spaces' => ['space' => 'none'],
21+
// @todo: Can be dropped once we enable @PER-CS2.0
22+
'concat_space' => ['spacing' => 'one'],
23+
'declare_equal_normalize' => ['space' => 'none'],
24+
'declare_parentheses' => true,
25+
'dir_constant' => true,
26+
// @todo: Can be dropped once we enable @PER-CS2.0
27+
'function_declaration' => [
28+
'closure_fn_spacing' => 'none',
29+
],
30+
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
31+
'type_declaration_spaces' => true,
32+
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
33+
'list_syntax' => ['syntax' => 'short'],
34+
// @todo: Can be dropped once we enable @PER-CS2.0
35+
'method_argument_space' => true,
36+
'modernize_strpos' => true,
37+
'modernize_types_casting' => true,
38+
'native_function_casing' => true,
39+
'no_alias_functions' => true,
40+
'no_blank_lines_after_phpdoc' => true,
41+
'no_empty_phpdoc' => true,
42+
'no_empty_statement' => true,
43+
'no_extra_blank_lines' => true,
44+
'no_leading_namespace_whitespace' => true,
45+
'no_null_property_initialization' => true,
46+
'no_short_bool_cast' => true,
47+
'no_singleline_whitespace_before_semicolons' => true,
48+
'no_superfluous_elseif' => true,
49+
'no_trailing_comma_in_singleline' => true,
50+
'no_unneeded_control_parentheses' => true,
51+
'no_unused_imports' => true,
52+
'no_useless_nullsafe_operator' => true,
53+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
54+
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
55+
'php_unit_mock_short_will_return' => true,
56+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
57+
'phpdoc_no_access' => true,
58+
'phpdoc_no_empty_return' => true,
59+
'phpdoc_no_package' => true,
60+
'phpdoc_scalar' => true,
61+
'phpdoc_trim' => true,
62+
'phpdoc_types' => true,
63+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
64+
'return_type_declaration' => ['space_before' => 'none'],
65+
'single_quote' => true,
66+
'single_space_around_construct' => true,
67+
'single_line_comment_style' => ['comment_types' => ['hash']],
68+
// @todo: Can be dropped once we enable @PER-CS2.0
69+
'single_line_empty_body' => true,
70+
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']],
71+
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
72+
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
73+
74+
// We need this for documentation!
75+
'no_useless_else' => false, // We want to preserve else with comments only
76+
]);

0 commit comments

Comments
 (0)