Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drop Codeception 4 support, php < 8.0 and symfony < 5.0
Browse files Browse the repository at this point in the history
sidz committed Oct 15, 2023
1 parent 9cccc6c commit 3405451
Showing 17 changed files with 1,181 additions and 1,525 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -18,18 +18,15 @@ jobs:

strategy:
matrix:
php-version: ['7.4', '8.0', '8.1']
coverage-driver: [pcov]
symfony-require: ['^4', '^5', '^6']
exclude:
- symfony-require: "^6"
php-version: "7.4"
php-version: [ '8.0', '8.1', '8.2' ]
coverage-driver: [ pcov ]
symfony-require: [ '^5', '^6' ]

name: CI with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }}, with Symfony ${{ matrix.symfony-require }}

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -52,7 +49,7 @@ jobs:
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: Configure Symfony Flex
run: composer config extra.symfony.require ${{ matrix.symfony-require }}

8 changes: 4 additions & 4 deletions .github/workflows/cs.yaml
Original file line number Diff line number Diff line change
@@ -16,15 +16,15 @@ jobs:

strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['7.4']
check: ['cs', 'static-analyze']
operating-system: [ ubuntu-latest ]
php-version: [ '8.0' ]
check: [ 'cs', 'static-analyze' ]

name: Coding Standards on PHP ${{ matrix.php-version }}

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
php-version: [ '7.4', '8.0', '8.1' ]
php-version: [ '8.0', '8.1', '8.2' ]
coverage-driver: [ pcov ]

name: CI with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }}
8 changes: 4 additions & 4 deletions .github/workflows/mt.yaml
Original file line number Diff line number Diff line change
@@ -16,15 +16,15 @@ jobs:

strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['7.4']
coverage-driver: [pcov]
operating-system: [ ubuntu-latest ]
php-version: [ '8.1' ]
coverage-driver: [ pcov ]

name: Mutation testing with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
11 changes: 6 additions & 5 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -36,11 +36,11 @@
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$header = trim(sprintf(
$header = \trim(\sprintf(
'This code is licensed under the BSD 3-Clause License.%s',
substr(
file_get_contents('LICENSE'),
strlen('BSD 3-Clause License')
\substr(
\file_get_contents('LICENSE'),
\strlen('BSD 3-Clause License')
)
));

@@ -85,7 +85,8 @@
'yield',
],
],
'compact_nullable_typehint' => true,
'blank_line_between_import_groups' => false,
'compact_nullable_type_declaration' => true,
'concat_space' => ['spacing' => 'one'],
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ JOBS=$(shell nproc)

# PHP CS Fixer
PHP_CS_FIXER=./.tools/php-cs-fixer
PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar"
PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.35.1/php-cs-fixer.phar"

# PHPUnit
PHPUNIT=vendor/bin/phpunit
@@ -28,9 +28,9 @@ COMPOSER=$(PHP) $(shell which composer)

# Infection
INFECTION=./.tools/infection.phar
INFECTION_URL="https://github.com/infection/infection/releases/download/0.24.0/infection.phar"
MIN_MSI=87
MIN_COVERED_MSI=99
INFECTION_URL="https://github.com/infection/infection/releases/download/0.27.4/infection.phar"
MIN_MSI=75
MIN_COVERED_MSI=80
INFECTION_ARGS=--min-msi=$(MIN_MSI) --min-covered-msi=$(MIN_COVERED_MSI) --threads=$(JOBS) --log-verbosity=none --no-interaction --no-progress --show-mutations

all: test
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -29,12 +29,12 @@
}
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"infection/abstract-testframework-adapter": "^0.5.0",
"infection/include-interceptor": "^0.2.0",
"symfony/filesystem": "^4.4 || ^5.0 || ^6.0",
"symfony/process": "^4.4 || ^5.0 || ^6.0",
"symfony/yaml": "^4.4 || ^5.0 || ^6.0"
"symfony/filesystem": "^5.0 || ^6.0",
"symfony/process": "^5.0 || ^6.0",
"symfony/yaml": "^5.0 || ^6.0"
},
"extra": {
"infection": {
@@ -44,15 +44,15 @@
"require-dev": {
"php-coveralls/php-coveralls": "^2.5",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^0.12.70",
"phpstan/phpstan-phpunit": "^0.12.17",
"phpstan/phpstan-strict-rules": "^0.12.9",
"phpstan/phpstan-webmozart-assert": "^0.12.9",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^9.5",
"thecodingmachine/safe": "^1.3",
"vimeo/psalm": "^4.12"
"vimeo/psalm": "^5.15"
},
"conflict": {
"codeception/codeception": "<4.1.9"
"codeception/codeception": "<5.0.0"
}
}
1,721 changes: 861 additions & 860 deletions composer.lock

Large diffs are not rendered by default.

38 changes: 36 additions & 2 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
parameters:
ignoreErrors:
-
message: "#^Cannot access offset 'tests' on mixed\\.$#"
count: 1
path: src/CodeceptionAdapter.php

-
message: "#^Method Infection\\\\TestFramework\\\\Codeception\\\\CodeceptionAdapter\\:\\:getOriginalBootstrapFilePath\\(\\) should return string\\|null but returns mixed\\.$#"
count: 1
path: src/CodeceptionAdapter.php

-
message: "#^Parameter \\#1 \\$file of method Symfony\\\\Component\\\\Filesystem\\\\Filesystem\\:\\:isAbsolutePath\\(\\) expects string, mixed given\\.$#"
count: 1
path: src/CodeceptionAdapter.php

-
message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
count: 1
path: src/CodeceptionAdapter.php

-
message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: src/CodeceptionAdapter.php

-
message: "#^Parameter \\#4 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: src/CodeceptionAdapter.php

-
message: "#^Method Infection\\\\TestFramework\\\\Codeception\\\\CodeceptionAdapterFactory\\:\\:parseYaml\\(\\) should return array\\<string, mixed\\> but returns mixed\\.$#"
count: 1
path: src/CodeceptionAdapterFactory.php

-
message: "#^Parameter \\#7 \\$sourceDirectories \\(array\\<string\\>\\) of method Infection\\\\TestFramework\\\\Codeception\\\\CodeceptionAdapterFactory\\:\\:create\\(\\) should be contravariant with parameter \\$sourceDirectories \\(array\\) of method Infection\\\\AbstractTestFramework\\\\TestFrameworkAdapterFactory\\:\\:create\\(\\)$#"
count: 1
@@ -11,12 +46,11 @@ parameters:
path: src/CommandLineBuilder.php

-
message: "#^Call to static method Webmozart\\\\Assert\\\\Mixin\\:\\:allString\\(\\) with array\\<string\\> will always evaluate to true\\.$#"
message: "#^Call to static method Webmozart\\\\Assert\\\\Assert\\:\\:allString\\(\\) with array\\<string\\> will always evaluate to true\\.$#"
count: 1
path: src/Stringifier.php

-
message: "#^Parameter \\#1 \\$arrayOfStrings of static method Infection\\\\TestFramework\\\\Codeception\\\\Stringifier\\:\\:stringifyArray\\(\\) expects array\\<string\\>, array\\<int, int\\> given\\.$#"
count: 1
path: tests/phpunit/Adapter/StringifierTest.php

42 changes: 5 additions & 37 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,48 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.12.0@e42bc4a23f67acba28a23bb09c348e2ff38a1d87">
<file src="src/CodeceptionAdapter.php">
<MixedArgument occurrences="5">
<code>$includedFiles</code>
<code>$this-&gt;originalConfigContentParsed['bootstrap']</code>
<code>$this-&gt;originalConfigContentParsed['bootstrap']</code>
<code>$this-&gt;originalConfigContentParsed['coverage'] ?? []</code>
<code>$this-&gt;originalConfigContentParsed['paths']['tests'] ?? 'tests'</code>
</MixedArgument>
<MixedAssignment occurrences="1">
<code>$includedFiles</code>
</MixedAssignment>
<MixedInferredReturnType occurrences="1">
<code>?string</code>
</MixedInferredReturnType>
<MixedReturnStatement occurrences="1">
<code>$this-&gt;originalConfigContentParsed['bootstrap']</code>
</MixedReturnStatement>
</file>
<files psalm-version="5.15.0@5c774aca4746caf3d239d9c8cadb9f882ca29352">
<file src="src/CodeceptionAdapterFactory.php">
<MixedAssignment occurrences="1">
<code>$codeceptionConfigContentParsed</code>
</MixedAssignment>
<MixedInferredReturnType occurrences="1">
<code>array&lt;string, mixed&gt;</code>
</MixedInferredReturnType>
<MixedReturnStatement occurrences="1">
<code>$codeceptionConfigContentParsed</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType occurrences="1">
<MoreSpecificImplementedParamType>
<code>$sourceDirectories</code>
</MoreSpecificImplementedParamType>
</file>
<file src="src/CommandLineBuilder.php">
<ForbiddenCode occurrences="1">
<code>shell_exec('command -v php')</code>
<ForbiddenCode>
<code><![CDATA[shell_exec('command -v php')]]></code>
</ForbiddenCode>
<UndefinedClass occurrences="1">
<UndefinedClass>
<code>FinderException</code>
</UndefinedClass>
</file>
<file src="src/Stringifier.php">
<UnusedMethodCall occurrences="1">
<code>allString</code>
</UnusedMethodCall>
</file>
</files>
4 changes: 3 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0"?>
<psalm
totallyTyped="true"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
findUnusedCode="false"
findUnusedPsalmSuppress="true"
findUnusedBaselineEntry="true"
>
<projectFiles>
<directory name="src" />
4 changes: 2 additions & 2 deletions src/CodeceptionAdapter.php
Original file line number Diff line number Diff line change
@@ -56,8 +56,8 @@
use function Safe\file_put_contents;
use function sprintf;
use function str_replace;
use function str_starts_with;
use function strlen;
use function strpos;
use function strstr;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\Process;
@@ -273,7 +273,7 @@ private function getInterceptorFileContent(string $interceptorPath, string $orig
{
$infectionPhar = '';

if (strpos(__FILE__, 'phar:') === 0) {
if (str_starts_with(__FILE__, 'phar:')) {
$infectionPhar = sprintf(
'\Phar::loadPhar("%s", "%s");',
str_replace('phar://', '', Phar::running(true)),
6 changes: 3 additions & 3 deletions tests/e2e/Codeception_Basic/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"require-dev": {
"codeception/codeception": "^4.1.9",
"codeception/module-asserts": "^1.3"
"codeception/codeception": "^5.0",
"codeception/module-asserts": "^3.0.0"
},
"autoload": {
"psr-4": {
@@ -14,7 +14,7 @@
}
},
"require": {
"infection/infection": "0.25.0",
"infection/infection": "0.26.19",
"infection/codeception-adapter": "dev-master"
},
"config": {
1 change: 1 addition & 0 deletions tests/e2e/Codeception_Basic/expected-output.txt
Original file line number Diff line number Diff line change
@@ -6,4 +6,5 @@ Syntax Errors: 0
Escaped: 1
Timed Out: 0
Skipped: 0
Ignored: 0
Not Covered: 0

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/e2e/Codeception_With_Suite_Overridings/composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"require-dev": {
"codeception/codeception": "^4.1.9",
"codeception/module-db": "^1.1",
"infection/infection": "0.25.0",
"codeception/codeception": "^5.0",
"codeception/module-db": "^3.0.0",
"infection/infection": "0.26.19",
"infection/codeception-adapter": "dev-master"
},
"autoload": {
Original file line number Diff line number Diff line change
@@ -6,4 +6,5 @@ Syntax Errors: 0
Escaped: 0
Timed Out: 0
Skipped: 0
Ignored: 0
Not Covered: 0

0 comments on commit 3405451

Please sign in to comment.