From 5372735e0db92f65b98426dbc44001b3bab8a1e3 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Sun, 2 Aug 2026 09:36:11 +0200 Subject: [PATCH 01/11] Support maintained PHPUnit versions --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 09d7c3d..10197f4 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "disambiguation", "segmentation" ], - "homepage": "https://github.com/vanderlee/php-sentence.git", + "homepage": "https://github.com/vanderlee/php-sentence", "license": "MIT", "support": { "issues": "https://github.com/vanderlee/php-sentence/issues", @@ -27,9 +27,9 @@ } }, "require-dev": { - "phpunit/phpunit": "^3.6.12" + "phpunit/phpunit": "^4.8 || ^5.7 || ^9.6" }, "scripts": { - "test": "vendor/bin/phpunit" + "test": "phpunit" } } From 766acdde1e37efaebca2f1206d8ff54d2a125e40 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Sun, 2 Aug 2026 09:36:18 +0200 Subject: [PATCH 02/11] Make the test bootstrap portable --- tests/bootstrap.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 253b9db..92b1478 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,13 +1,21 @@ Date: Sun, 2 Aug 2026 09:36:27 +0200 Subject: [PATCH 03/11] Add GitHub Actions test matrix --- .github/workflows/tests.yml | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3e7e824 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,52 @@ +name: Tests + +on: + pull_request: + push: + branches: + - master + workflow_dispatch: + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - php: '5.4' + composer: 'v1' + - php: '5.6' + composer: '2.2' + - php: '7.4' + composer: 'v2' + - php: '8.0' + composer: 'v2' + - php: '8.4' + composer: 'v2' + + name: PHP ${{ matrix.php }} + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, ctype + tools: composer:${{ matrix.composer }} + coverage: none + + - name: Validate Composer metadata + run: composer validate --strict + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist + + - name: Run tests + run: composer test From 07349eae920af8116a3db92729cfc18a80461920 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Sun, 2 Aug 2026 09:36:33 +0200 Subject: [PATCH 04/11] Remove obsolete Travis configuration --- .travis.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eab8d7a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: php - -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - - 8.0 - - 8.1 - - 8.2 - - 8.3 - - hhvm - -matrix: - include: - - php: 5.3 - dist: precise - allow_failures: - - php: 5.3 - - php: hhvm - -before_script: - - mkdir -p cache - - composer install - -script: - - vendor/bin/phpunit From 2756f8e86e4bc5dc3bea0726365e1ad3b0b76887 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Sun, 2 Aug 2026 09:46:10 +0200 Subject: [PATCH 05/11] Replace the Travis badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e7777f..8e563c4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Sentence ======== [![License](https://img.shields.io/github/license/vanderlee/php-sentence.svg)]() -[![Build Status](https://travis-ci.org/vanderlee/php-sentence.svg?branch=master)](https://travis-ci.org/vanderlee/php-sentence) +[![Tests](https://github.com/vanderlee/php-sentence/actions/workflows/tests.yml/badge.svg)](https://github.com/vanderlee/php-sentence/actions/workflows/tests.yml) [![Quality](https://scrutinizer-ci.com/g/vanderlee/php-sentence/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/vanderlee/php-sentence) Version 1.0.8 From 445024217370cc6a8bde98786fe7349b0116ff48 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Sun, 2 Aug 2026 09:48:24 +0200 Subject: [PATCH 06/11] Test PHP 8.5 --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3e7e824..a84da02 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,6 +27,8 @@ jobs: composer: 'v2' - php: '8.4' composer: 'v2' + - php: '8.5' + composer: 'v2' name: PHP ${{ matrix.php }} From 5f3156b143ea70a353ef10d8925faee578e46432 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Mon, 3 Aug 2026 07:58:44 +0200 Subject: [PATCH 07/11] Prepare PHPUnit fixture compatibility patch --- tools/apply-phpunit-fixture-compat.py | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tools/apply-phpunit-fixture-compat.py diff --git a/tools/apply-phpunit-fixture-compat.py b/tools/apply-phpunit-fixture-compat.py new file mode 100644 index 0000000..2910e30 --- /dev/null +++ b/tools/apply-phpunit-fixture-compat.py @@ -0,0 +1,67 @@ +from pathlib import Path + +path = Path('tests/SentenceTest.php') +source = path.read_text(encoding='utf-8') +old = ' protected function setUp()\n' +new = " /**\n * @before\n */\n protected function setUpFixture()\n" +if source.count(old) != 1: + raise SystemExit('Expected SentenceTest::setUp exactly once') +path.write_text(source.replace(old, new), encoding='utf-8') + +final_workflow = '''name: Tests + +on: + pull_request: + push: + branches: + - master + workflow_dispatch: + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - php: '5.4' + composer: 'v1' + - php: '5.6' + composer: '2.2' + - php: '7.4' + composer: 'v2' + - php: '8.0' + composer: 'v2' + - php: '8.4' + composer: 'v2' + - php: '8.5' + composer: 'v2' + + name: PHP ${{ matrix.php }} + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, ctype + tools: composer:${{ matrix.composer }} + coverage: none + + - name: Validate Composer metadata + run: composer validate --strict + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist + + - name: Run tests + run: composer test +''' +Path('.github/workflows/tests.yml').write_text(final_workflow, encoding='utf-8') +Path('tools/apply-phpunit-fixture-compat.py').unlink() From 4c053e00a8dff024023de964881ca5b52ae609c5 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Mon, 3 Aug 2026 07:58:55 +0200 Subject: [PATCH 08/11] Apply cross-version PHPUnit fixture patch --- .github/workflows/tests.yml | 61 +++++++++++-------------------------- 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a84da02..19d2b24 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,54 +1,27 @@ -name: Tests +name: Apply PHPUnit fixture compatibility on: pull_request: - push: - branches: - - master - workflow_dispatch: permissions: - contents: read + contents: write jobs: - test: + patch: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - php: '5.4' - composer: 'v1' - - php: '5.6' - composer: '2.2' - - php: '7.4' - composer: 'v2' - - php: '8.0' - composer: 'v2' - - php: '8.4' - composer: 'v2' - - php: '8.5' - composer: 'v2' - - name: PHP ${{ matrix.php }} - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 + - uses: actions/checkout@v4 with: - php-version: ${{ matrix.php }} - extensions: mbstring, ctype - tools: composer:${{ matrix.composer }} - coverage: none - - - name: Validate Composer metadata - run: composer validate --strict - - - name: Install dependencies - run: composer install --no-interaction --prefer-dist - - - name: Run tests - run: composer test + ref: agent/modernize-test-matrix + fetch-depth: 0 + + - name: Apply compatibility patch + run: python3 tools/apply-phpunit-fixture-compat.py + + - name: Commit patched fixture and restored workflow + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add tests/SentenceTest.php .github/workflows/tests.yml tools/apply-phpunit-fixture-compat.py + git commit -m "Make PHPUnit fixture setup cross-version compatible" + git push origin HEAD:agent/modernize-test-matrix From 03f9ebc003ad7d622ce7b86c892669000a037ad7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 05:59:05 +0000 Subject: [PATCH 09/11] Make PHPUnit fixture setup cross-version compatible --- .github/workflows/tests.yml | 61 +++++++++++++++++------- tests/SentenceTest.php | 5 +- tools/apply-phpunit-fixture-compat.py | 67 --------------------------- 3 files changed, 48 insertions(+), 85 deletions(-) delete mode 100644 tools/apply-phpunit-fixture-compat.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 19d2b24..a84da02 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,27 +1,54 @@ -name: Apply PHPUnit fixture compatibility +name: Tests on: pull_request: + push: + branches: + - master + workflow_dispatch: permissions: - contents: write + contents: read jobs: - patch: + test: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - php: '5.4' + composer: 'v1' + - php: '5.6' + composer: '2.2' + - php: '7.4' + composer: 'v2' + - php: '8.0' + composer: 'v2' + - php: '8.4' + composer: 'v2' + - php: '8.5' + composer: 'v2' + + name: PHP ${{ matrix.php }} + steps: - - uses: actions/checkout@v4 + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 with: - ref: agent/modernize-test-matrix - fetch-depth: 0 - - - name: Apply compatibility patch - run: python3 tools/apply-phpunit-fixture-compat.py - - - name: Commit patched fixture and restored workflow - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add tests/SentenceTest.php .github/workflows/tests.yml tools/apply-phpunit-fixture-compat.py - git commit -m "Make PHPUnit fixture setup cross-version compatible" - git push origin HEAD:agent/modernize-test-matrix + php-version: ${{ matrix.php }} + extensions: mbstring, ctype + tools: composer:${{ matrix.composer }} + coverage: none + + - name: Validate Composer metadata + run: composer validate --strict + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist + + - name: Run tests + run: composer test diff --git a/tests/SentenceTest.php b/tests/SentenceTest.php index ac77127..0bbc3b7 100644 --- a/tests/SentenceTest.php +++ b/tests/SentenceTest.php @@ -20,7 +20,10 @@ class SentenceTest extends PHPUnit_Framework_TestCase * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ - protected function setUp() + /** + * @before + */ + protected function setUpFixture() { $this->object = new Sentence(); } diff --git a/tools/apply-phpunit-fixture-compat.py b/tools/apply-phpunit-fixture-compat.py deleted file mode 100644 index 2910e30..0000000 --- a/tools/apply-phpunit-fixture-compat.py +++ /dev/null @@ -1,67 +0,0 @@ -from pathlib import Path - -path = Path('tests/SentenceTest.php') -source = path.read_text(encoding='utf-8') -old = ' protected function setUp()\n' -new = " /**\n * @before\n */\n protected function setUpFixture()\n" -if source.count(old) != 1: - raise SystemExit('Expected SentenceTest::setUp exactly once') -path.write_text(source.replace(old, new), encoding='utf-8') - -final_workflow = '''name: Tests - -on: - pull_request: - push: - branches: - - master - workflow_dispatch: - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - php: '5.4' - composer: 'v1' - - php: '5.6' - composer: '2.2' - - php: '7.4' - composer: 'v2' - - php: '8.0' - composer: 'v2' - - php: '8.4' - composer: 'v2' - - php: '8.5' - composer: 'v2' - - name: PHP ${{ matrix.php }} - - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: mbstring, ctype - tools: composer:${{ matrix.composer }} - coverage: none - - - name: Validate Composer metadata - run: composer validate --strict - - - name: Install dependencies - run: composer install --no-interaction --prefer-dist - - - name: Run tests - run: composer test -''' -Path('.github/workflows/tests.yml').write_text(final_workflow, encoding='utf-8') -Path('tools/apply-phpunit-fixture-compat.py').unlink() From ceb64e292025d43a71b9cd91f73bcc5cce3c894c Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Mon, 3 Aug 2026 09:07:36 +0200 Subject: [PATCH 10/11] Use supported Composer for PHP 5.4 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a84da02..d4f20f4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: matrix: include: - php: '5.4' - composer: 'v1' + composer: '2.2' - php: '5.6' composer: '2.2' - php: '7.4' From 93e1eb064ccdcaa0a8d17be1efe3863b997c5333 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Mon, 3 Aug 2026 10:20:10 +0200 Subject: [PATCH 11/11] Use the maintained checkout action --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d4f20f4..7b65655 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up PHP uses: shivammathur/setup-php@v2