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),