Skip to content

Commit 7891736

Browse files
committed
Drop support for old PHP versions
1 parent e1dd118 commit 7891736

File tree

6 files changed

+67
-41
lines changed

6 files changed

+67
-41
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
name: Check composer.json
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
- uses: shivammathur/setup-php@v2
1414
with:
1515
coverage: none
16-
php-version: '8.0'
16+
php-version: '8.3'
1717
- run: composer validate --strict --no-check-lock
1818

1919
tests:
@@ -26,12 +26,12 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
php: [ '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
29+
php: ['7.4', '8.0', '8.1', '8.2', '8.3' ]
3030
min_stability: [ '' ]
3131
name_suffix: [ '' ]
3232
composer_flags: [ '' ]
3333
include:
34-
- php: '8.0'
34+
- php: '8.3'
3535
min_stability: 'dev'
3636
name_suffix: ' (dev deps)'
3737
- php: '7.4'
@@ -40,7 +40,7 @@ jobs:
4040
composer_flags: '--prefer-lowest --prefer-stable'
4141

4242
steps:
43-
- uses: actions/checkout@v2
43+
- uses: actions/checkout@v4
4444
- uses: shivammathur/setup-php@v2
4545
with:
4646
coverage: "none"
@@ -53,8 +53,5 @@ jobs:
5353
- name: Install dependencies
5454
run: composer update --ansi --no-progress --prefer-dist --no-interaction ${{ matrix.composer_flags }}
5555

56-
- name: Install PHPUnit
57-
run: vendor/bin/simple-phpunit install
58-
5956
- name: Run tests
60-
run: vendor/bin/simple-phpunit
57+
run: vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ composer.lock
22
phpunit.xml
33
vendor
44
build
5+
/.phpunit.result.cache

Tests/ProcessorTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22

33
namespace Incenteev\ParameterHandler\Tests;
44

5+
use Composer\IO\IOInterface;
56
use Incenteev\ParameterHandler\Processor;
67
use PHPUnit\Framework\TestCase;
8+
use Prophecy\PhpUnit\ProphecyTrait;
9+
use Prophecy\Prophecy\ObjectProphecy;
710
use Symfony\Component\Filesystem\Filesystem;
811
use Symfony\Component\Yaml\Yaml;
912

1013
class ProcessorTest extends TestCase
1114
{
15+
use ProphecyTrait;
16+
17+
/**
18+
* @var ObjectProphecy<IOInterface>
19+
*/
1220
private $io;
1321
private $environmentBackup = array();
1422

@@ -17,15 +25,15 @@ class ProcessorTest extends TestCase
1725
*/
1826
private $processor;
1927

20-
protected function setUp()
28+
protected function setUp(): void
2129
{
2230
parent::setUp();
2331

2432
$this->io = $this->prophesize('Composer\IO\IOInterface');
2533
$this->processor = new Processor($this->io->reveal());
2634
}
2735

28-
protected function tearDown()
36+
protected function tearDown(): void
2937
{
3038
parent::tearDown();
3139

@@ -45,12 +53,8 @@ public function testInvalidConfiguration(array $config, $exceptionMessage)
4553
{
4654
chdir(__DIR__);
4755

48-
if (method_exists($this, 'expectException')) {
49-
$this->expectException('InvalidArgumentException');
50-
$this->expectExceptionMessage($exceptionMessage);
51-
} else {
52-
$this->setExpectedException('InvalidArgumentException', $exceptionMessage);
53-
}
56+
$this->expectException('InvalidArgumentException');
57+
$this->expectExceptionMessage($exceptionMessage);
5458

5559
$this->processor->processFile($config);
5660
}

Tests/ScriptHandlerTest.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,38 @@
22

33
namespace Incenteev\ParameterHandler\Tests;
44

5+
use Composer\IO\IOInterface;
6+
use Composer\Package\RootPackageInterface;
7+
use Composer\Script\Event;
58
use Incenteev\ParameterHandler\ScriptHandler;
69
use PHPUnit\Framework\TestCase;
10+
use Prophecy\PhpUnit\ProphecyTrait;
11+
use Prophecy\Prophecy\ObjectProphecy;
712

813
class ScriptHandlerTest extends TestCase
914
{
15+
use ProphecyTrait;
16+
17+
/**
18+
* @var ObjectProphecy<Event>
19+
*/
1020
private $event;
21+
/**
22+
* @var ObjectProphecy<IOInterface>
23+
*/
1124
private $io;
25+
/**
26+
* @var ObjectProphecy<RootPackageInterface>
27+
*/
1228
private $package;
1329

14-
protected function setUp()
30+
protected function setUp(): void
1531
{
1632
parent::setUp();
1733

1834
$this->event = $this->prophesize('Composer\Script\Event');
1935
$this->io = $this->prophesize('Composer\IO\IOInterface');
20-
$this->package = $this->prophesize('Composer\Package\PackageInterface');
36+
$this->package = $this->prophesize(RootPackageInterface::class);
2137
$composer = $this->prophesize('Composer\Composer');
2238

2339
$composer->getPackage()->willReturn($this->package);
@@ -34,12 +50,8 @@ public function testInvalidConfiguration(array $extras, $exceptionMessage)
3450

3551
chdir(__DIR__);
3652

37-
if (method_exists($this, 'expectException')) {
38-
$this->expectException('InvalidArgumentException');
39-
$this->expectExceptionMessage($exceptionMessage);
40-
} else {
41-
$this->setExpectedException('InvalidArgumentException', $exceptionMessage);
42-
}
53+
$this->expectException('InvalidArgumentException');
54+
$this->expectExceptionMessage($exceptionMessage);
4355

4456
ScriptHandler::buildParameters($this->event->reveal());
4557
}

composer.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,25 @@
1111
}
1212
],
1313
"require": {
14-
"php": ">=5.3.3",
15-
"symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
14+
"php": ">=7.4",
15+
"symfony/yaml": "^5.4 || ^6.0"
1616
},
1717
"require-dev": {
18-
"composer/composer": "^1.0@dev",
19-
"symfony/filesystem": "^2.3 || ^3 || ^4 || ^5 || ^6.0",
20-
"symfony/phpunit-bridge": "^3.4.47 || ^4.4.41 || ^5.4.8 || ^6.0"
18+
"composer/composer": "^2.0@dev",
19+
"phpspec/prophecy-phpunit": "^2.1",
20+
"phpunit/phpunit": "^9.6",
21+
"symfony/filesystem": "^5.4 || ^6.0",
22+
"symfony/phpunit-bridge": "^6.4.1 || ^7.0.1"
2123
},
2224
"autoload": {
2325
"psr-4": { "Incenteev\\ParameterHandler\\": "" }
2426
},
27+
"config": {
28+
"sort-packages": true
29+
},
2530
"extra": {
2631
"branch-alias": {
27-
"dev-master": "2.1.x-dev"
32+
"dev-master": "2.x-dev"
2833
}
2934
}
3035
}

phpunit.xml.dist

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<phpunit colors="true" bootstrap="vendor/autoload.php">
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
colors="true"
6+
bootstrap="vendor/autoload.php">
47
<testsuites>
58
<testsuite name="Incenteev ParameterHandler Test Suite">
69
<directory suffix="Test.php">./Tests/</directory>
710
</testsuite>
811
</testsuites>
912

10-
<filter>
11-
<whitelist>
12-
<directory>./</directory>
13-
<exclude>
14-
<directory>./Tests</directory>
15-
<directory>./vendor</directory>
16-
</exclude>
17-
</whitelist>
18-
</filter>
13+
<coverage processUncoveredFiles="true">
14+
<include>
15+
<directory>.</directory>
16+
</include>
17+
<exclude>
18+
<directory>./Tests</directory>
19+
<directory>./vendor</directory>
20+
</exclude>
21+
</coverage>
22+
23+
<listeners>
24+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
25+
</listeners>
1926
</phpunit>

0 commit comments

Comments
 (0)