From d65cdc47a8631f1a82a4185287ecf87e430b8e57 Mon Sep 17 00:00:00 2001 From: W0rma Date: Mon, 1 Nov 2021 09:10:32 +0100 Subject: [PATCH 1/8] Migrate the CI to GitHub Actions --- .github/workflows/ci.yaml | 60 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 41 -------------------------- 2 files changed, 60 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..a1f668b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,60 @@ +name: CI + +on: + push: + pull_request: + +jobs: + check_composer: + name: Check composer.json + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + coverage: none + php-version: '8.0' + - 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: [ '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ] + min_stability: [ '' ] + name_suffix: [ '' ] + composer_flags: [ '' ] + include: + - php: '8.0' + 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@v2 + - 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: Install PHPUnit + run: vendor/bin/simple-phpunit install + + - name: Run tests + run: vendor/bin/simple-phpunit \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cbd5450..0000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -language: php - -sudo: false - -cache: - directories: - - $HOME/.composer/cache/files - - $HOME/.phpunit-bridge - -env: - global: - - SYMFONY_PHPUNIT_DIR=$HOME/.phpunit-bridge - - SYMFONY_PHPUNIT_REMOVE='' # don't remove prophecy - - SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 - -php: [7.4, 7.3, 7.2, 7.1, 7.0, 5.6] - -matrix: - include: - - php: 7.2 - env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' - - php: 5.3 - dist: precise - - php: 5.4 - dist: trusty - - php: 5.5 - dist: trusty - - php: 7.4 - env: STABILITY=dev - -before_install: - - if [[ -v $STABILITY ]]; then composer config minimum-stability $STABILITY; fi; - -install: - - composer update --prefer-dist --no-interaction $COMPOSER_FLAGS - - vendor/bin/simple-phpunit install - -script: vendor/bin/simple-phpunit --coverage-text --coverage-clover=coverage.clover - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover From b631476616698a26ceb5bfcbbd75482c9e1e742f Mon Sep 17 00:00:00 2001 From: W0rma Date: Tue, 2 Nov 2021 21:40:51 +0100 Subject: [PATCH 2/8] Allow installation of symfony 6 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 275e83c..6dedc35 100644 --- a/composer.json +++ b/composer.json @@ -12,12 +12,12 @@ ], "require": { "php": ">=5.3.3", - "symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0" + "symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { "composer/composer": "^1.0@dev", - "symfony/filesystem": "^2.3 || ^3 || ^4 || ^5", - "symfony/phpunit-bridge": "^4.0 || ^5.0" + "symfony/filesystem": "^2.3 || ^3 || ^4 || ^5 || ^6.0", + "symfony/phpunit-bridge": "^4.0 || ^5.0 || ^6.0" }, "autoload": { "psr-4": { "Incenteev\\ParameterHandler\\": "" } From 9827f798eaefcd1c6c1e1d4e92ec66b053aee441 Mon Sep 17 00:00:00 2001 From: W0rma Date: Wed, 3 Nov 2021 19:35:29 +0100 Subject: [PATCH 3/8] Fix badges after migration to Github Actions --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 0f42600..ac92755 100644 --- a/README.md +++ b/README.md @@ -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) From a7ad09e618356c78749e0d52e1aa5f9268408a11 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 25 May 2022 12:51:15 +0200 Subject: [PATCH 4/8] Update the changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7544706..8331924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.5 (2022-05-25) + +* Mark symfony/yaml 6 as supported + ## 2.1.4 (2020-03-17) * Mark symfony/yaml 5 as supported From e1dd118763503f7fd766f907013e1d76d525fcc4 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 25 May 2022 12:57:22 +0200 Subject: [PATCH 5/8] Fix the lowest-deps job --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6dedc35..a0ff03e 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require-dev": { "composer/composer": "^1.0@dev", "symfony/filesystem": "^2.3 || ^3 || ^4 || ^5 || ^6.0", - "symfony/phpunit-bridge": "^4.0 || ^5.0 || ^6.0" + "symfony/phpunit-bridge": "^3.4.47 || ^4.4.41 || ^5.4.8 || ^6.0" }, "autoload": { "psr-4": { "Incenteev\\ParameterHandler\\": "" } From 789173640e61ecfdad0b500cb8f47538b6d00113 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 9 Dec 2023 10:55:01 +0100 Subject: [PATCH 6/8] Drop support for old PHP versions --- .github/workflows/ci.yaml | 15 ++++++--------- .gitignore | 1 + Tests/ProcessorTest.php | 20 ++++++++++++-------- Tests/ScriptHandlerTest.php | 28 ++++++++++++++++++++-------- composer.json | 17 +++++++++++------ phpunit.xml.dist | 27 +++++++++++++++++---------- 6 files changed, 67 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a1f668b..cba151d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: @@ -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' @@ -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" @@ -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 \ No newline at end of file + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index 2ac90de..81d0d62 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ composer.lock phpunit.xml vendor build +/.phpunit.result.cache diff --git a/Tests/ProcessorTest.php b/Tests/ProcessorTest.php index 4a1163d..b44c990 100644 --- a/Tests/ProcessorTest.php +++ b/Tests/ProcessorTest.php @@ -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 + */ private $io; private $environmentBackup = array(); @@ -17,7 +25,7 @@ class ProcessorTest extends TestCase */ private $processor; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -25,7 +33,7 @@ protected function setUp() $this->processor = new Processor($this->io->reveal()); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); @@ -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); } diff --git a/Tests/ScriptHandlerTest.php b/Tests/ScriptHandlerTest.php index 7430200..a791f90 100644 --- a/Tests/ScriptHandlerTest.php +++ b/Tests/ScriptHandlerTest.php @@ -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 + */ private $event; + /** + * @var ObjectProphecy + */ private $io; + /** + * @var ObjectProphecy + */ 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); @@ -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()); } diff --git a/composer.json b/composer.json index a0ff03e..ed19531 100644 --- a/composer.json +++ b/composer.json @@ -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" } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a274a5f..228a200 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,19 +1,26 @@ - + ./Tests/ - - - ./ - - ./Tests - ./vendor - - - + + + . + + + ./Tests + ./vendor + + + + + + From b5c26e84c36723d5936673273928dbea13f508f1 Mon Sep 17 00:00:00 2001 From: Jan Rosier Date: Sat, 11 Nov 2023 21:07:09 +0100 Subject: [PATCH 7/8] Allow Symfony 7 Allow installation with Symfony 7 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index ed19531..9545d99 100644 --- a/composer.json +++ b/composer.json @@ -12,13 +12,13 @@ ], "require": { "php": ">=7.4", - "symfony/yaml": "^5.4 || ^6.0" + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "composer/composer": "^2.0@dev", "phpspec/prophecy-phpunit": "^2.1", "phpunit/phpunit": "^9.6", - "symfony/filesystem": "^5.4 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", "symfony/phpunit-bridge": "^6.4.1 || ^7.0.1" }, "autoload": { From 90bffce926e96b365579a2ef024aab457f4b80c5 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 9 Dec 2023 11:31:14 +0100 Subject: [PATCH 8/8] Update the changelog for 2.2.0 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8331924..bc831a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 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