From 63c10642ce72fc40a81e48a158ee0ced86786ad4 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 29 Jan 2022 19:11:46 -0300 Subject: [PATCH 1/6] Bump phpunit --- composer.json | 5 +++-- phpunit.xml | 21 +++++++++++---------- tests/Driver/DefaultDriverTest.php | 2 ++ tests/Driver/Fpdi2DriverTest.php | 2 ++ tests/Driver/TcpdiDriverTest.php | 2 ++ tests/MergerTest.php | 2 ++ 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 195d0aa..56b69b1 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,8 @@ "rafikhaceb/tcpdi": "*" }, "require-dev": { - "phpunit/phpunit": "^7|^8", - "smalot/pdfparser": "~0.13" + "phpunit/phpunit": "^9.5", + "smalot/pdfparser": "~0.13", + "phpspec/prophecy-phpunit": "^2.0" } } diff --git a/phpunit.xml b/phpunit.xml index db44d5a..f296f21 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,15 +1,16 @@ - + - ./tests - - - ./tests/ReadmeIntegration.php + tests - - - ./src - - diff --git a/tests/Driver/DefaultDriverTest.php b/tests/Driver/DefaultDriverTest.php index 7defcad..04db6ee 100644 --- a/tests/Driver/DefaultDriverTest.php +++ b/tests/Driver/DefaultDriverTest.php @@ -5,9 +5,11 @@ namespace iio\libmergepdf\Driver; use iio\libmergepdf\Source\SourceInterface; +use Prophecy\PhpUnit\ProphecyTrait; class DefaultDriverTest extends \PHPUnit\Framework\TestCase { + use ProphecyTrait; public function testMerge() { $wrapped = $this->prophesize(DriverInterface::CLASS); diff --git a/tests/Driver/Fpdi2DriverTest.php b/tests/Driver/Fpdi2DriverTest.php index 9649d0d..711b5f0 100644 --- a/tests/Driver/Fpdi2DriverTest.php +++ b/tests/Driver/Fpdi2DriverTest.php @@ -9,9 +9,11 @@ use iio\libmergepdf\Source\SourceInterface; use setasign\Fpdi\Tcpdf\Fpdi; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; class Fpdi2DriverTest extends \PHPUnit\Framework\TestCase { + use ProphecyTrait; public function testExceptionOnInvalidFpdi() { $this->expectException(\InvalidArgumentException::CLASS); diff --git a/tests/Driver/TcpdiDriverTest.php b/tests/Driver/TcpdiDriverTest.php index aa7b285..88b40fb 100644 --- a/tests/Driver/TcpdiDriverTest.php +++ b/tests/Driver/TcpdiDriverTest.php @@ -7,9 +7,11 @@ use iio\libmergepdf\Source\SourceInterface; use iio\libmergepdf\Exception; use iio\libmergepdf\Pages; +use Prophecy\PhpUnit\ProphecyTrait; class TcpdiDriverTest extends \PHPUnit\Framework\TestCase { + use ProphecyTrait; public function testExceptionOnFailure() { $tcpdi = $this->prophesize(\TCPDI::CLASS); diff --git a/tests/MergerTest.php b/tests/MergerTest.php index a8e7a5a..a57c773 100644 --- a/tests/MergerTest.php +++ b/tests/MergerTest.php @@ -7,9 +7,11 @@ use iio\libmergepdf\Driver\DriverInterface; use iio\libmergepdf\Source\FileSource; use iio\libmergepdf\Source\RawSource; +use Prophecy\PhpUnit\ProphecyTrait; class MergerTest extends \PHPUnit\Framework\TestCase { + use ProphecyTrait; public function testAddRaw() { $pages = $this->createMock(PagesInterface::CLASS); From e0c92faca0fc9e6d34c43c2cf7d624033eda483b Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 29 Jan 2022 19:23:08 -0300 Subject: [PATCH 2/6] Drop support to old versions of PHP to work with new version of PHPUnit --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index be3c435..29d9a17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ php: - 8.0 - 7.4 - 7.3 - - 7.2 - - 7.1 install: - composer install From 76459795080739a719f557d0408eb7b9e39310e5 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 29 Jan 2022 20:13:31 -0300 Subject: [PATCH 3/6] Run PHPUnit on github actions --- .github/workflows/phpunit.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/phpunit.yml diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 0000000..16ff7d1 --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,34 @@ +name: PHPUnit + +on: + pull_request: + push: + branches: [ master ] + +jobs: + phpunit: + runs-on: ubuntu-latest + strategy: + # do not stop on another job's failure + fail-fast: false + matrix: + coverage: ['xdebug'] + xdebug_mode: ['debug'] + php-versions: ['7.3', '7.4', '8.0'] + name: php${{ matrix.php-versions }} + + steps: + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: ${{ matrix.coverage }} + tools: phpunit + + - name: Set up PHP dependencies + run: composer i + + - name: PHPUnit + env: + XDEBUG_MODE: ${{ matrix.xdebug_mode }} + run: ./vendor/phpunit/phpunit/phpunit -c phpunit.xml From 305e0b7a55cc6fe09e42476eeecc6cf023a6ef5a Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 29 Jan 2022 21:16:49 -0300 Subject: [PATCH 4/6] Move CI from travis to GitHub Actions --- .github/workflows/behat.yml | 38 +++++++++++++++++++++++++++++++++++ .github/workflows/phpunit.yml | 18 ++++++++++++----- .travis.yml | 17 ---------------- composer.json | 3 ++- 4 files changed, 53 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/behat.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/behat.yml b/.github/workflows/behat.yml new file mode 100644 index 0000000..9d51e34 --- /dev/null +++ b/.github/workflows/behat.yml @@ -0,0 +1,38 @@ +name: Behat + +on: + pull_request: + push: + branches: [ master ] + +jobs: + phpunit: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.3', '7.4', '8.0'] + name: php${{ matrix.php-versions }} + + steps: + - uses: actions/checkout@v2 + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: ${{ matrix.coverage }} + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Set up PHP dependencies + run: composer i + + - name: Behat + run: vendor/bin/behat diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 16ff7d1..15dc731 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -9,8 +9,6 @@ jobs: phpunit: runs-on: ubuntu-latest strategy: - # do not stop on another job's failure - fail-fast: false matrix: coverage: ['xdebug'] xdebug_mode: ['debug'] @@ -18,15 +16,25 @@ jobs: name: php${{ matrix.php-versions }} steps: + - uses: actions/checkout@v2 + - name: Set up php ${{ matrix.php-versions }} uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} coverage: ${{ matrix.coverage }} - tools: phpunit - - name: Set up PHP dependencies - run: composer i + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress - name: PHPUnit env: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 29d9a17..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -sudo: false - -language: php - -php: - - 8.0 - - 7.4 - - 7.3 - -install: - - composer install - - composer global require behat/behat - - export PATH=$PATH:$HOME/.config/composer/vendor/bin/ - -script: - - vendor/bin/phpunit - - behat diff --git a/composer.json b/composer.json index 56b69b1..c4be533 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "require": { "php": "^7.1||^8.0", "tecnickcom/tcpdf": "^6.2.22", - "setasign/fpdi": "^2" + "setasign/fpdi": "^2", + "behat/behat": "^3.10" }, "conflict": { "setasign/fpdf": "*", From 8f14fd75aaf1e28575258ba424ba1f52d05cc394 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 29 Jan 2022 21:23:14 -0300 Subject: [PATCH 5/6] Run CI on PHP 8.1 --- .github/workflows/behat.yml | 2 +- .github/workflows/phpunit.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/behat.yml b/.github/workflows/behat.yml index 9d51e34..295bba5 100644 --- a/.github/workflows/behat.yml +++ b/.github/workflows/behat.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['7.3', '7.4', '8.0'] + php-versions: ['7.3', '7.4', '8.0', '8.1'] name: php${{ matrix.php-versions }} steps: diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 15dc731..38434de 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -12,7 +12,7 @@ jobs: matrix: coverage: ['xdebug'] xdebug_mode: ['debug'] - php-versions: ['7.3', '7.4', '8.0'] + php-versions: ['7.3', '7.4', '8.0', '8.1'] name: php${{ matrix.php-versions }} steps: From 36cc6a8e013fbe390b71d2388a6e4c8b9d0c684e Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sun, 30 Jan 2022 15:28:11 -0300 Subject: [PATCH 6/6] Moved behat to require-dev --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index c4be533..27e5cc7 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,7 @@ "require": { "php": "^7.1||^8.0", "tecnickcom/tcpdf": "^6.2.22", - "setasign/fpdi": "^2", - "behat/behat": "^3.10" + "setasign/fpdi": "^2" }, "conflict": { "setasign/fpdf": "*", @@ -32,6 +31,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "smalot/pdfparser": "~0.13", - "phpspec/prophecy-phpunit": "^2.0" + "phpspec/prophecy-phpunit": "^2.0", + "behat/behat": "^3.10" } }