Skip to content

Commit 7e5d3ee

Browse files
author
Stefan Boonstra
committed
WIP
1 parent 3e1206b commit 7e5d3ee

File tree

9 files changed

+67
-29
lines changed

9 files changed

+67
-29
lines changed

.github/workflows/testing-suite.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ jobs:
55
strategy:
66
matrix:
77
image: [
8-
'srcoder/development-php:php74-fpm',
9-
'srcoder/development-php:php80-fpm',
10-
'srcoder/development-php:php81-fpm'
8+
'srcoder/development-php:php81-fpm',
9+
'srcoder/development-php:php82-fpm'
1110
]
1211
runs-on: ubuntu-latest
1312
container:
@@ -19,5 +18,18 @@ jobs:
1918
run: |
2019
composer2 install --dev --prefer-dist --no-scripts --no-progress --optimize-autoloader --no-interaction -vvv
2120
composer2 show
22-
composer2 exec -v grumphp run
21+
composer2 exec -v grumphp -- run --tasks=composer,jsonlint,xmllint,yamllint,phpcs,phplint,phpmd,securitychecker_enlightn
22+
shell: bash
23+
PHPWithUnitTests:
24+
runs-on: ubuntu-latest
25+
container:
26+
image: 'srcoder/development-php:php83-fpm'
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
- name: Testing Suite
31+
run: |
32+
composer2 install --dev --prefer-dist --no-scripts --no-progress --optimize-autoloader --no-interaction -vvv
33+
composer2 show
34+
composer2 exec -v grumphp -- run --tasks=composer,jsonlint,xmllint,yamllint,phpcs,phplint,phpmd,phpstan,phpunit,securitychecker_enlightn
2335
shell: bash

CONTRIBUTING.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Before opening a PR with changes, make sure all the linting steps are successful.
2+
3+
The require-dev dependency for phpunit is set to @stable for the github actions, but the tests themselves\
4+
assume they are running against PHPUnit 12 and php >= 8.3. The github actions only run phpunit tests against\
5+
a php 8.3 container.
6+
17
If a PR is approved please ask one of the following maintainers to get it merged:
2-
[Igor Wulff](https://github.com/igorwulff)
3-
[Dan Wallis](https://github.com/fredden)
8+
9+
- [Igor Wulff](https://github.com/igorwulff)
10+
- [Leon Helmus](https://github.com/leonhelmus)
11+
- [Rutger Rademakers](https://github.com/rutgerrademaker)

composer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,25 @@
2424
}
2525
],
2626
"require": {
27-
"php": "^7.2 || ^8.0",
27+
"php": "^8.1",
2828
"composer-plugin-api": "^1.1 || ^2.0",
2929
"enlightn/security-checker": "^1.5 || ^2.0",
3030
"kint-php/kint": "@stable",
3131
"php-parallel-lint/php-parallel-lint": "^1.2",
3232
"phpro/grumphp-shim": "^1.13",
3333
"phpstan/phpstan": "@stable",
34-
"phpunit/phpunit": "@stable",
3534
"youwe/coding-standard": "^3.5.0",
36-
"youwe/coding-standard-phpstorm": "^2.3.0",
3735
"youwe/composer-dependency-installer": "^1.4.0",
3836
"youwe/composer-file-installer": "^1.2.0"
3937
},
38+
"suggest": {
39+
"phpunit/phpunit": "^9.6 || ^10.5 || ^11.5 || ^12.0",
40+
"youwe/coding-standard-phpstorm": "^2.3.0"
41+
},
4042
"require-dev": {
4143
"composer/composer": "@stable",
42-
"mikey179/vfsstream": "@stable"
44+
"mikey179/vfsstream": "@stable",
45+
"phpunit/phpunit": "@stable"
4346
},
4447
"replace": {
4548
"sensiolabs/security-checker": "*"

src/Factory/ProcessFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ProcessFactory implements ProcessFactoryInterface
2323
public function create(string $commandLine): Process
2424
{
2525
// See https://github.com/composer/composer/blob/1.10.17/src/Composer/Util/ProcessExecutor.php#L68:L72
26+
// @phpstan-ignore-next-line because phpstan can see it's available, but we cannot guarantee symfony >= 4.2 upstream
2627
return method_exists(Process::class, 'fromShellCommandline')
2728
? Process::fromShellCommandline($commandLine) // Symfony >= 4.2
2829
: new Process($commandLine); // Symfony < 4.2

src/Installer/ArchiveExcludeInstaller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use Youwe\TestingSuite\Composer\MappingResolver;
1717

1818
/**
19-
* @SuppressWarnings(PHPMD.ShortVariable)
20-
* @SuppressWarnings(PHPMD.StaticAccess)
19+
* @SuppressWarnings("PHPMD.ShortVariable")
20+
* @SuppressWarnings("PHPMD.StaticAccess")
2121
*/
2222
class ArchiveExcludeInstaller implements InstallerInterface
2323
{

src/Installer/ConfigInstaller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
use Youwe\TestingSuite\Composer\ConfigResolver;
1616

1717
/**
18-
* @SuppressWarnings(PHPMD.ShortVariable)
19-
* @SuppressWarnings(PHPMD.StaticAccess)
18+
* @SuppressWarnings("PHPMD.ShortVariable")
19+
* @SuppressWarnings("PHPMD.StaticAccess")
2020
*/
2121
class ConfigInstaller implements InstallerInterface
2222
{

src/Installer/FilesInstaller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Youwe\TestingSuite\Composer\MappingResolver;
1616

1717
/**
18-
* @SuppressWarnings(PHPMD.ShortVariable)
18+
* @SuppressWarnings("PHPMD.ShortVariable")
1919
*/
2020
class FilesInstaller implements InstallerInterface
2121
{
@@ -72,7 +72,7 @@ public function install(): void
7272
/**
7373
* @param FileMappingInterface $unixFileMapping
7474
*
75-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
75+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
7676
*
7777
* @return void
7878
*/

src/Installer/PackagesInstaller.php

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Youwe\TestingSuite\Composer\ProjectTypeResolver;
1717

1818
/**
19-
* @SuppressWarnings(PHPMD.ShortVariable)
19+
* @SuppressWarnings("PHPMD.ShortVariable")
2020
*/
2121
class PackagesInstaller implements InstallerInterface
2222
{
@@ -34,36 +34,48 @@ class PackagesInstaller implements InstallerInterface
3434

3535
/** @var array */
3636
private $mapping = [
37-
MappingResolver::DEFAULT_MAPPING_TYPE => [],
37+
MappingResolver::DEFAULT_MAPPING_TYPE => [
38+
[
39+
'name' => 'phpunit/phpunit',
40+
'version' => '@stable',
41+
'dev' => true,
42+
'allowVersionOverride' => false
43+
]
44+
],
3845
'magento1' => [
3946
[
4047
'name' => 'youwe/coding-standard-magento1',
4148
'version' => '^1.3.0',
42-
'dev' => true
49+
'dev' => true,
50+
'allowVersionOverride' => true
4351
]
4452
],
4553
'magento2' => [
4654
[
4755
'name' => 'youwe/coding-standard-magento2',
4856
'version' => '^2.0.0',
49-
'dev' => true
57+
'dev' => true,
58+
'allowVersionOverride' => true
5059
],
5160
[
5261
'name' => 'phpstan/extension-installer',
5362
'version' => '^1.3',
54-
'dev' => true
63+
'dev' => true,
64+
'allowVersionOverride' => true,
5565
],
5666
[
5767
'name' => 'bitexpert/phpstan-magento',
5868
'version' => '~0.30',
59-
'dev' => true
69+
'dev' => true,
70+
'allowVersionOverride' => true,
6071
],
6172
],
6273
'laravel' => [
6374
[
6475
'name' => 'elgentos/laravel-coding-standard',
6576
'version' => '^1.0.0',
66-
'dev' => true
77+
'dev' => true,
78+
'allowVersionOverride' => true,
6779
]
6880
]
6981
];
@@ -99,19 +111,21 @@ public function __construct(
99111
public function install(): void
100112
{
101113
$type = $this->typeResolver->resolve();
102-
if (!isset($this->mapping[$type])) {
103-
return;
104-
}
114+
$projectTypePackages = $this->mapping[$type] ?? [];
115+
$packagesToInstall = array_merge($projectTypePackages, $this->mapping[MappingResolver::DEFAULT_MAPPING_TYPE]);
105116

106-
foreach ($this->mapping[$type] as $package) {
117+
foreach ($packagesToInstall as $package) {
107118
if (!$this->isPackageRequired($package['name'], $package['version'])) {
108119
$this->io->write(
109120
sprintf('Requiring package %s', $package['name'])
110121
);
111122

112123
$this->installer->installPackage(
113124
$package['name'],
114-
$package['version']
125+
$package['version'],
126+
true,
127+
false,
128+
$package['allowVersionOverride']
115129
);
116130
}
117131
}

src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Youwe\TestingSuite\Composer\Installer\InstallerInterface;
1717

1818
/**
19-
* @SuppressWarnings(PHPMD.ShortVariable)
19+
* @SuppressWarnings("PHPMD.ShortVariable")
2020
*/
2121
class Plugin implements PluginInterface, EventSubscriberInterface
2222
{

0 commit comments

Comments
 (0)