From 4078f3b5efeb0ea80af6af07fb9bee504db4ff8b Mon Sep 17 00:00:00 2001 From: Tom Kay Date: Thu, 22 Oct 2026 12:42:22 +0100 Subject: [PATCH] Run the 1.x tests on PHP 8 under GitHub Actions Replace CircleCI with a GitHub Actions matrix (PHP 7.4, 8.2-8.5, APCu enabled), and move the tests to phpunit 9.6 so they run on PHP 8: setUp/tearDown return void, and string haystacks use assertStringContainsString. Drops the unused php-coveralls dev dependency and phpunit config options phpunit 9 no longer reads. Composer blocks the Symfony 3.4 packages this branch pins over security advisories, so the root config allows them. It only applies when this repository is installed directly, never to projects that depend on it. Co-Authored-By: Claude Opus 5.5 --- .circleci/config.yml | 49 ------------------------------------- .github/workflows/ci.yml | 41 +++++++++++++++++++++++++++++++ .gitignore | 3 +++ composer.json | 13 ++++++++-- phpunit.xml | 6 ++--- tests/AssetResponseTest.php | 2 +- tests/DispatchTest.php | 2 +- tests/PathSecurityTest.php | 4 +-- 8 files changed, 61 insertions(+), 59 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e8615bf..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,49 +0,0 @@ -defaults: &defaults - steps: - # Install runtime and test extensions before resolving Composer dependencies. - - run: - name: Install PHP extensions - command: | - apk add --no-cache $PHPIZE_DEPS curl git unzip - pecl install apcu - docker-php-ext-enable apcu - echo 'apc.enable_cli=1' > /usr/local/etc/php/conf.d/apcu-cli.ini - echo 'date.timezone=UTC' > /usr/local/etc/php/conf.d/timezone.ini - - run: curl -fsS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer - - # pre-checkout steps - - # checkout - - checkout - - # post-checkout steps - - # run tests - # The 1.x dependency ranges only resolve to releases with published advisories. - - run: composer install -n --prefer-dist --no-security-blocking - - run: php vendor/phpunit/phpunit/phpunit -c phpunit.xml --log-junit /tmp/test-results/phpunit/junit.xml - - store_test_results: - path: /tmp/test-results - -version: 2 -jobs: - build-php72: - <<: *defaults - docker: - - image: php:7.2-alpine - build-php73: - <<: *defaults - docker: - - image: php:7.3-alpine - build-php74: - <<: *defaults - docker: - - image: php:7.4-alpine - -workflows: - version: 2 - build: - jobs: - - build-php72 - - build-php73 - - build-php74 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2df4699 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + branches: + - "1.0" + pull_request: + branches: + - "1.0" + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php-version: + - "7.4" + - "8.2" + - "8.3" + - "8.4" + - "8.5" + + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: none + extensions: apcu + ini-values: apc.enable_cli=1 + + - name: Composer install + run: composer install + + - name: PHPUnit + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4901aab --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/vendor +/composer.lock +/.phpunit.result.cache diff --git a/composer.json b/composer.json index b137a2a..fb09170 100644 --- a/composer.json +++ b/composer.json @@ -20,12 +20,21 @@ }, "require-dev": { "php": ">=7.0", - "phpunit/phpunit": "~6.3", - "satooshi/php-coveralls": "~0" + "phpunit/phpunit": "^9.6" }, "autoload": { "psr-4": { "Packaged\\Dispatch\\": "src" } + }, + "config": { + "audit": { + "block-insecure": false + }, + "policy": { + "advisories": { + "block": false + } + } } } diff --git a/phpunit.xml b/phpunit.xml index b18bb74..76438d2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -3,17 +3,15 @@ bootstrap="vendor/autoload.php" colors="true" verbose="true" - strict="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" > - + tests - \ No newline at end of file + diff --git a/tests/AssetResponseTest.php b/tests/AssetResponseTest.php index f6c43cb..b1d09cb 100644 --- a/tests/AssetResponseTest.php +++ b/tests/AssetResponseTest.php @@ -24,7 +24,7 @@ public function testResponse() $response = $builder->createResponse($asset, $request); $this->assertEquals('text/css', $response->headers->get('Content-Type')); - $this->assertContains('background:blue', (string)$response); + $this->assertStringContainsString('background:blue', (string)$response); $this->assertInstanceOf( '\Symfony\Component\HttpFoundation\Response', $response diff --git a/tests/DispatchTest.php b/tests/DispatchTest.php index 25296bb..def9999 100644 --- a/tests/DispatchTest.php +++ b/tests/DispatchTest.php @@ -42,7 +42,7 @@ public function testUrls($config, $path, $host, $expect) $dispatcher = new \Packaged\Dispatch\Dispatch(new DummyKernel(), $config); $resp = $dispatcher->handle($request); - $this->assertContains($expect, $resp->getContent()); + $this->assertStringContainsString($expect, $resp->getContent()); } public function urlProvider() diff --git a/tests/PathSecurityTest.php b/tests/PathSecurityTest.php index 46bdd93..cea0168 100644 --- a/tests/PathSecurityTest.php +++ b/tests/PathSecurityTest.php @@ -9,7 +9,7 @@ class PathSecurityTest extends TestCase { private $root; - protected function setUp() + protected function setUp(): void { $this->root = sys_get_temp_dir() . '/dispatch-security-' . uniqid(); foreach(['resources/nested', 'public', 'src', 'vendor/acme/package', 'resources-private'] as $dir) @@ -29,7 +29,7 @@ protected function setUp() symlink($this->root . '/absent', $this->root . '/resources/broken.css'); } - protected function tearDown() + protected function tearDown(): void { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($this->root, FilesystemIterator::SKIP_DOTS),