diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6cdbd0b..54cef90 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 - name: Validate composer.json @@ -27,18 +27,23 @@ jobs: composer_option: '--prefer-lowest' env: SYMFONY_DEPRECATIONS_HELPER: max[self]=0 + - description: 'PHP 8.0' + php: '8.0' + - description: 'PHP 8.1' + php: '8.1' - description: 'Dev deps' - php: '7.4' + php: '8.2' dev: true name: PHP ${{ matrix.php }} tests (${{ matrix.description }}) steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - run: | phpenv config-rm xdebug.ini || true + composer global config --no-plugins allow-plugins.symfony/flex true composer global require --no-progress --no-scripts --no-plugins symfony/flex 1.* - name: Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.composer/cache/files key: composer-${{ matrix.php }}-${{ matrix.symfony }}-${{ matrix.composer_option }} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4f8c9ee..3d0fd04 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,7 +10,7 @@ failOnWarning="true" > - + @@ -28,4 +28,4 @@ - \ No newline at end of file + diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index 72e0be1..209f281 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -11,7 +11,7 @@ class ConfigurationTest extends TestCase /** * @dataProvider dataForProcessedConfiguration */ - public function testProcessedConfiguration($configs, $expectedConfig) + public function testProcessedConfiguration($configs, $expectedConfig): void { $processor = new Processor(); $configuration = new Configuration(); @@ -20,7 +20,7 @@ public function testProcessedConfiguration($configs, $expectedConfig) $this->assertEquals($expectedConfig, $config); } - public function dataForProcessedConfiguration() + public function dataForProcessedConfiguration(): array { return [ [ diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index 6430792..cfabbbd 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -13,7 +13,7 @@ class FunctionalTest extends TestCase /** @var Filesystem */ private $filesystem; - public function setUp() + public function setUp(): void { $this->kernel = new TestKernel(uniqid(), false); @@ -21,12 +21,12 @@ public function setUp() $this->filesystem->mkdir($this->kernel->getCacheDir()); } - public function tearDown() + public function tearDown(): void { $this->filesystem->remove($this->kernel->getCacheDir()); } - public function testServiceIsAvailableOutOfTheBox() + public function testServiceIsAvailableOutOfTheBox(): void { $this->kernel->setConfigurationFilename(__DIR__ . '/fixtures/config/out_of_the_box.yml'); $this->kernel->boot(); @@ -48,7 +48,7 @@ public function testServiceIsAvailableOutOfTheBox() $this->assertEquals('wkhtmltoimage', $image->getBinary()); } - public function testChangeBinaries() + public function testChangeBinaries(): void { $this->kernel->setConfigurationFilename(__DIR__ . '/fixtures/config/change_binaries.yml'); $this->kernel->boot(); @@ -68,7 +68,7 @@ public function testChangeBinaries() $this->assertEquals('/custom/binary/for/wkhtmltoimage', $image->getBinary()); } - public function testChangeTemporaryFolder() + public function testChangeTemporaryFolder(): void { $this->kernel->setConfigurationFilename(__DIR__ . '/fixtures/config/change_temporary_folder.yml'); $this->kernel->boot(); @@ -82,7 +82,7 @@ public function testChangeTemporaryFolder() $this->assertEquals('/path/to/the/tmp', $image->getTemporaryFolder()); } - public function testDisablePdf() + public function testDisablePdf(): void { $this->kernel->setConfigurationFilename(__DIR__ . '/fixtures/config/disable_pdf.yml'); $this->kernel->boot(); @@ -93,7 +93,7 @@ public function testDisablePdf() $this->assertTrue($container->has('knp_snappy.image'), 'The image service is available.'); } - public function testDisableImage() + public function testDisableImage(): void { $this->kernel->setConfigurationFilename(__DIR__ . '/fixtures/config/disable_image.yml'); $this->kernel->boot(); diff --git a/tests/Snappy/Generator/LoggableGeneratorTest.php b/tests/Snappy/Generator/LoggableGeneratorTest.php index ebda2b2..98cd079 100644 --- a/tests/Snappy/Generator/LoggableGeneratorTest.php +++ b/tests/Snappy/Generator/LoggableGeneratorTest.php @@ -10,7 +10,7 @@ */ class LoggableGeneratorTest extends TestCase { - public function testGenerate() + public function testGenerate(): void { $internal = $this->createMock('Knp\Snappy\GeneratorInterface'); $internal @@ -33,7 +33,7 @@ public function testGenerate() $generator->generate('the_input_file', 'the_output_file', ['foo' => 'bar'], true); } - public function testGenerateFromHtml() + public function testGenerateFromHtml(): void { $internal = $this->createMock('Knp\Snappy\GeneratorInterface'); $internal @@ -56,7 +56,7 @@ public function testGenerateFromHtml() $generator->generateFromHtml('foo', 'the_output_file', ['foo' => 'bar'], true); } - public function testGenerateFromHtmlWithHtmlArray() + public function testGenerateFromHtmlWithHtmlArray(): void { $internal = $this->createMock('Knp\Snappy\GeneratorInterface'); $internal @@ -79,7 +79,7 @@ public function testGenerateFromHtmlWithHtmlArray() $generator->generateFromHtml(['foo', 'bar'], 'the_output_file', ['foo' => 'bar'], true); } - public function testOutput() + public function testOutput(): void { $internal = $this->createMock('Knp\Snappy\GeneratorInterface'); $internal @@ -100,7 +100,7 @@ public function testOutput() $generator->getOutput('the_input_file', ['foo' => 'bar'], true); } - public function testOutputFromHtml() + public function testOutputFromHtml(): void { $internal = $this->createMock('Knp\Snappy\GeneratorInterface'); $internal @@ -121,7 +121,7 @@ public function testOutputFromHtml() $generator->getOutputFromHtml('foo', ['foo' => 'bar'], true); } - public function testOutputFromHtmlWithHtmlArray() + public function testOutputFromHtmlWithHtmlArray(): void { $internal = $this->createMock('Knp\Snappy\GeneratorInterface'); $internal @@ -142,7 +142,7 @@ public function testOutputFromHtmlWithHtmlArray() $generator->getOutputFromHtml(['foo'], ['foo' => 'bar'], true); } - public function testSetOption() + public function testSetOption(): void { $internal = $this->createMock('Knp\Snappy\Image'); $internal diff --git a/tests/Snappy/Response/JpegResponseTest.php b/tests/Snappy/Response/JpegResponseTest.php index 8f59463..9a0cb82 100644 --- a/tests/Snappy/Response/JpegResponseTest.php +++ b/tests/Snappy/Response/JpegResponseTest.php @@ -7,7 +7,7 @@ class JpegResponseTest extends TestCase { - public function testDefaultParameters() + public function testDefaultParameters(): void { $response = new JpegResponse('some_binary_output'); @@ -17,14 +17,14 @@ public function testDefaultParameters() $this->assertSame('inline; filename=output.jpg', str_replace('"', '', $response->headers->get('Content-Disposition'))); } - public function testSetDifferentMimeType() + public function testSetDifferentMimeType(): void { $response = new JpegResponse('some_binary_output', 'test.jpg', 'application/octet-stream'); $this->assertSame('application/octet-stream', $response->headers->get('Content-Type')); } - public function testSetDifferentFileName() + public function testSetDifferentFileName(): void { $fileName = 'test.jpg'; $response = new JpegResponse('some_binary_output', $fileName); diff --git a/tests/Snappy/Response/PdfResponseTest.php b/tests/Snappy/Response/PdfResponseTest.php index 61fceca..1fc93b5 100644 --- a/tests/Snappy/Response/PdfResponseTest.php +++ b/tests/Snappy/Response/PdfResponseTest.php @@ -7,7 +7,7 @@ class PdfResponseTest extends TestCase { - public function testDefaultParameters() + public function testDefaultParameters(): void { $response = new PdfResponse('some_binary_output'); @@ -17,14 +17,14 @@ public function testDefaultParameters() $this->assertSame('attachment; filename=output.pdf', str_replace('"', '', $response->headers->get('Content-Disposition'))); } - public function testSetDifferentMimeType() + public function testSetDifferentMimeType(): void { $response = new PdfResponse('some_binary_output', 'test.pdf', 'application/octet-stream'); $this->assertSame('application/octet-stream', $response->headers->get('Content-Type')); } - public function testSetDifferentFileName() + public function testSetDifferentFileName(): void { $fileName = 'test.pdf'; $response = new PdfResponse('some_binary_output', $fileName); diff --git a/tests/Snappy/Response/SnappyResponseTest.php b/tests/Snappy/Response/SnappyResponseTest.php index a1679fe..3bdb890 100644 --- a/tests/Snappy/Response/SnappyResponseTest.php +++ b/tests/Snappy/Response/SnappyResponseTest.php @@ -7,7 +7,7 @@ class SnappyResponseTest extends TestCase { - public function testExceptionMessage() + public function testExceptionMessage(): void { try { new SnappyResponse('', 'test.jpg', 'image/jpg', 'foo'); diff --git a/tests/TestKernel.php b/tests/TestKernel.php index 7b46b74..6271814 100644 --- a/tests/TestKernel.php +++ b/tests/TestKernel.php @@ -14,7 +14,7 @@ class TestKernel extends Kernel * * @param string $filename */ - public function setConfigurationFilename($filename) + public function setConfigurationFilename($filename): void { $this->configurationFilename = $filename; } @@ -33,7 +33,7 @@ public function registerBundles(): iterable /** * {@inheritdoc} */ - public function registerContainerConfiguration(LoaderInterface $loader) + public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load($this->configurationFilename); } diff --git a/tests/fixtures/config/base.yml b/tests/fixtures/config/base.yml index a746bf4..2c18b8b 100644 --- a/tests/fixtures/config/base.yml +++ b/tests/fixtures/config/base.yml @@ -2,3 +2,4 @@ framework: secret: ThisIsNotReallyASecretSoPleaseChangeIt router: { resource: "%kernel.project_dir%/config/routing.yml", utf8: true } validation: { enabled: true, enable_annotations: false } + http_method_override: false