Skip to content

Commit

Permalink
Merge pull request #1 from Incenteev/master
Browse files Browse the repository at this point in the history
SF6 compat
  • Loading branch information
gnt-bill authored Oct 29, 2024
2 parents c46ec57 + 90bffce commit cf451dc
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 77 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
pull_request:

jobs:
check_composer:
name: Check composer.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.3'
- run: composer validate --strict --no-check-lock

tests:
name: "Tests on PHP ${{ matrix.php }}${{ matrix.name_suffix }}"
runs-on: ubuntu-latest
env:
SYMFONY_PHPUNIT_REMOVE: '' # don't remove prophecy
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: 1

strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3' ]
min_stability: [ '' ]
name_suffix: [ '' ]
composer_flags: [ '' ]
include:
- php: '8.3'
min_stability: 'dev'
name_suffix: ' (dev deps)'
- php: '7.4'
min_stability: ''
name_suffix: ' (lowest deps)'
composer_flags: '--prefer-lowest --prefer-stable'

steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php }}"

- name: Configure stability
if: "matrix.min_stability != ''"
run: composer config minimum-stability "${{ matrix.min_stability }}"

- name: Install dependencies
run: composer update --ansi --no-progress --prefer-dist --no-interaction ${{ matrix.composer_flags }}

- name: Run tests
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ composer.lock
phpunit.xml
vendor
build
/.phpunit.result.cache
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 2.2.0 (2023-12-09)

* Drop support for old PHP versions. The min version is now PGP 7.4.
* Drop support for old Symfony versions. The min version is now Symfony 5.4
* Mark symfony/yaml 7 as supported

## 2.1.5 (2022-05-25)

* Mark symfony/yaml 6 as supported

## 2.1.4 (2020-03-17)

* Mark symfony/yaml 5 as supported
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ install or update. It works when storing the parameters in a Yaml file under
a single top-level key (named ``parameters`` by default). Other keys are
copied without change.

[![Build Status](https://travis-ci.org/Incenteev/ParameterHandler.png)](https://travis-ci.org/Incenteev/ParameterHandler)
[![Code Coverage](https://scrutinizer-ci.com/g/Incenteev/ParameterHandler/badges/coverage.png?s=ea5de28d9764fdcb6a576a41e244c0ac537b3c81)](https://scrutinizer-ci.com/g/Incenteev/ParameterHandler/)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/Incenteev/ParameterHandler/badges/quality-score.png?s=6143d945bbdfac5c1114d4fe5d0f4ee737db18bf)](https://scrutinizer-ci.com/g/Incenteev/ParameterHandler/)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/3a432e49-6018-41a5-a37b-b7fb151706c1/mini.png)](https://insight.sensiolabs.com/projects/3a432e49-6018-41a5-a37b-b7fb151706c1)
[![CI](https://github.com/Incenteev/ParameterHandler/actions/workflows/ci.yaml/badge.svg)](https://github.com/Incenteev/ParameterHandler/actions/workflows/ci.yaml)
[![Latest Stable Version](https://poser.pugx.org/incenteev/composer-parameter-handler/v/stable.png)](https://packagist.org/packages/incenteev/composer-parameter-handler)
[![Latest Unstable Version](https://poser.pugx.org/incenteev/composer-parameter-handler/v/unstable.png)](https://packagist.org/packages/incenteev/composer-parameter-handler)

Expand Down
20 changes: 12 additions & 8 deletions Tests/ProcessorTest.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,25 @@
}
],
"require": {
"php": ">=5.3.3",
"symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0"
"php": ">=7.4",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"composer/composer": "^1.0@dev",
"symfony/filesystem": "^2.3 || ^3 || ^4 || ^5",
"symfony/phpunit-bridge": "^4.0 || ^5.0"
"composer/composer": "^2.0@dev",
"phpspec/prophecy-phpunit": "^2.1",
"phpunit/phpunit": "^9.6",
"symfony/filesystem": "^5.4 || ^6.0 || ^7.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
Original file line number Diff line number Diff line change
@@ -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 cf451dc

Please sign in to comment.