diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..7072300 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,27 @@ +on: push + +name: GitHub Action +jobs: + run: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4' ] + phpunit-versions: ['latest'] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + tools: composer + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: phpunit + run: composer test + diff --git a/composer.json b/composer.json index fdf7d7c..1b86c8d 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,9 @@ "php": ">=5.3.0", "ext-xmlwriter": "*" }, + "scripts": { + "test" : "@php vendor/bin/phpunit tests" + }, "require-dev": { "phpunit/phpunit": "~4.4" }, diff --git a/tests/IndexTest.php b/tests/IndexTest.php index eafb7b9..2d180b0 100644 --- a/tests/IndexTest.php +++ b/tests/IndexTest.php @@ -47,7 +47,7 @@ public function testWritingFileGzipped() $this->assertTrue(file_exists($fileName)); $finfo = new \finfo(FILEINFO_MIME_TYPE); - $this->assertEquals('application/x-gzip', $finfo->file($fileName)); + $this->assertRegExp('!application/(x-)?gzip!', $finfo->file($fileName)); $this->assertIsValidIndex('compress.zlib://' . $fileName); unlink($fileName); } diff --git a/tests/SitemapTest.php b/tests/SitemapTest.php index c1c4a14..28e1c51 100644 --- a/tests/SitemapTest.php +++ b/tests/SitemapTest.php @@ -197,7 +197,7 @@ public function testWritingFileGzipped() $this->assertTrue(file_exists($fileName)); $finfo = new \finfo(FILEINFO_MIME_TYPE); - $this->assertEquals('application/x-gzip', $finfo->file($fileName)); + $this->assertRegExp('!application/(x-)?gzip!', $finfo->file($fileName)); $this->assertIsValidSitemap('compress.zlib://' . $fileName); $this->assertIsOneMemberGzipFile($fileName); @@ -230,7 +230,7 @@ public function testMultipleFilesGzipped() $finfo = new \finfo(FILEINFO_MIME_TYPE); foreach ($expectedFiles as $expectedFile) { $this->assertTrue(file_exists($expectedFile), "$expectedFile does not exist!"); - $this->assertEquals('application/x-gzip', $finfo->file($expectedFile)); + $this->assertRegExp('!application/(x-)?gzip!', $finfo->file($expectedFile)); $this->assertIsValidSitemap('compress.zlib://' . $expectedFile); $this->assertIsOneMemberGzipFile($expectedFile); unlink($expectedFile);