Skip to content

Commit

Permalink
Merge pull request #144 from stof/drop_old_versions
Browse files Browse the repository at this point in the history
Drop support for old PHP versions
  • Loading branch information
stof committed Dec 9, 2023
2 parents e1dd118 + 7891736 commit 856d524
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 41 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/ci.yaml
Expand Up @@ -9,11 +9,11 @@ jobs:
name: Check composer.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.0'
php-version: '8.3'
- run: composer validate --strict --no-check-lock

tests:
Expand All @@ -26,12 +26,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
php: ['7.4', '8.0', '8.1', '8.2', '8.3' ]
min_stability: [ '' ]
name_suffix: [ '' ]
composer_flags: [ '' ]
include:
- php: '8.0'
- php: '8.3'
min_stability: 'dev'
name_suffix: ' (dev deps)'
- php: '7.4'
Expand All @@ -40,7 +40,7 @@ jobs:
composer_flags: '--prefer-lowest --prefer-stable'

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

- name: Install PHPUnit
run: vendor/bin/simple-phpunit install

- name: Run tests
run: vendor/bin/simple-phpunit
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@ composer.lock
phpunit.xml
vendor
build
/.phpunit.result.cache
20 changes: 12 additions & 8 deletions Tests/ProcessorTest.php
Expand Up @@ -2,13 +2,21 @@

namespace Incenteev\ParameterHandler\Tests;

use Composer\IO\IOInterface;
use Incenteev\ParameterHandler\Processor;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Yaml\Yaml;

class ProcessorTest extends TestCase
{
use ProphecyTrait;

/**
* @var ObjectProphecy<IOInterface>
*/
private $io;
private $environmentBackup = array();

Expand All @@ -17,15 +25,15 @@ class ProcessorTest extends TestCase
*/
private $processor;

protected function setUp()
protected function setUp(): void
{
parent::setUp();

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

protected function tearDown()
protected function tearDown(): void
{
parent::tearDown();

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

if (method_exists($this, 'expectException')) {
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage($exceptionMessage);
} else {
$this->setExpectedException('InvalidArgumentException', $exceptionMessage);
}
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage($exceptionMessage);

$this->processor->processFile($config);
}
Expand Down
28 changes: 20 additions & 8 deletions Tests/ScriptHandlerTest.php
Expand Up @@ -2,22 +2,38 @@

namespace Incenteev\ParameterHandler\Tests;

use Composer\IO\IOInterface;
use Composer\Package\RootPackageInterface;
use Composer\Script\Event;
use Incenteev\ParameterHandler\ScriptHandler;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;

class ScriptHandlerTest extends TestCase
{
use ProphecyTrait;

/**
* @var ObjectProphecy<Event>
*/
private $event;
/**
* @var ObjectProphecy<IOInterface>
*/
private $io;
/**
* @var ObjectProphecy<RootPackageInterface>
*/
private $package;

protected function setUp()
protected function setUp(): void
{
parent::setUp();

$this->event = $this->prophesize('Composer\Script\Event');
$this->io = $this->prophesize('Composer\IO\IOInterface');
$this->package = $this->prophesize('Composer\Package\PackageInterface');
$this->package = $this->prophesize(RootPackageInterface::class);
$composer = $this->prophesize('Composer\Composer');

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

chdir(__DIR__);

if (method_exists($this, 'expectException')) {
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage($exceptionMessage);
} else {
$this->setExpectedException('InvalidArgumentException', $exceptionMessage);
}
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage($exceptionMessage);

ScriptHandler::buildParameters($this->event->reveal());
}
Expand Down
17 changes: 11 additions & 6 deletions composer.json
Expand Up @@ -11,20 +11,25 @@
}
],
"require": {
"php": ">=5.3.3",
"symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
"php": ">=7.4",
"symfony/yaml": "^5.4 || ^6.0"
},
"require-dev": {
"composer/composer": "^1.0@dev",
"symfony/filesystem": "^2.3 || ^3 || ^4 || ^5 || ^6.0",
"symfony/phpunit-bridge": "^3.4.47 || ^4.4.41 || ^5.4.8 || ^6.0"
"composer/composer": "^2.0@dev",
"phpspec/prophecy-phpunit": "^2.1",
"phpunit/phpunit": "^9.6",
"symfony/filesystem": "^5.4 || ^6.0",
"symfony/phpunit-bridge": "^6.4.1 || ^7.0.1"
},
"autoload": {
"psr-4": { "Incenteev\\ParameterHandler\\": "" }
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
"dev-master": "2.x-dev"
}
}
}
27 changes: 17 additions & 10 deletions phpunit.xml.dist
@@ -1,19 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true" bootstrap="vendor/autoload.php">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="Incenteev ParameterHandler Test Suite">
<directory suffix="Test.php">./Tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
<coverage processUncoveredFiles="true">
<include>
<directory>.</directory>
</include>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
</phpunit>

0 comments on commit 856d524

Please sign in to comment.