From 9c929eec2654283766893c383e5701ee2c81c2bc Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Fri, 22 Nov 2019 20:22:39 +0100 Subject: [PATCH] Use better asserts --- .travis.yml | 2 +- Tests/AbstractTest.php | 1 + Tests/Async/ResolveCacheProcessorTest.php | 18 ++++++------- .../Console/Style/ImagineStyleTest.php | 26 +++++++++---------- .../Compiler/AbstractCompilerPassTestCase.php | 3 ++- Tests/Events/CacheResolveEventTest.php | 12 ++++----- .../InvalidOptionExceptionTest.php | 6 ++--- .../Command/AbstractCommandTestCase.php | 7 ++--- .../Command/RemoveCacheCommandTest.php | 20 +++++++------- .../Command/ResolveCacheCommandTest.php | 20 +++++++------- Tests/Imagine/Cache/CacheManagerTest.php | 2 +- .../Filter/FilterConfigurationTest.php | 6 ++--- .../AbstractPostProcessorTestCase.php | 4 +-- .../JpegOptimPostProcessorTest.php | 4 +-- .../MozJpegPostProcessorTest.php | 4 +-- .../OptiPngPostProcessorTest.php | 4 +-- phpunit.xml.dist | 3 +-- 17 files changed, 72 insertions(+), 70 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84e6fff8d..1da5be0e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ env: - SYMFONY_DEPRECATIONS_HELPER="max[self]=0" - PHPUNIT_FLAGS="-v" - PHPUNIT_ENABLED="true" - - SYMFONY_PHPUNIT_VERSION="6.5" + - SYMFONY_PHPUNIT_VERSION="7.5" - COVERALLS_ENABLED="false" - STABILITY=stable diff --git a/Tests/AbstractTest.php b/Tests/AbstractTest.php index c017ef21c..62f7500ba 100644 --- a/Tests/AbstractTest.php +++ b/Tests/AbstractTest.php @@ -25,6 +25,7 @@ use Liip\ImagineBundle\Imagine\Filter\FilterManager; use Liip\ImagineBundle\Imagine\Filter\PostProcessor\PostProcessorInterface; use Liip\ImagineBundle\Service\FilterService; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; diff --git a/Tests/Async/ResolveCacheProcessorTest.php b/Tests/Async/ResolveCacheProcessorTest.php index 7ebc8b9a4..712ab5e6a 100644 --- a/Tests/Async/ResolveCacheProcessorTest.php +++ b/Tests/Async/ResolveCacheProcessorTest.php @@ -41,32 +41,32 @@ public static function setUpBeforeClass() } } - public function testShouldImplementProcessorInterface() + public function testShouldImplementProcessorInterface(): void { $rc = new \ReflectionClass(ResolveCacheProcessor::class); $this->assertTrue($rc->implementsInterface(Processor::class)); } - public function testShouldImplementCommandSubscriberInterface() + public function testShouldImplementCommandSubscriberInterface(): void { $rc = new \ReflectionClass(ResolveCacheProcessor::class); $this->assertTrue($rc->implementsInterface(CommandSubscriberInterface::class)); } - public function testShouldImplementQueueSubscriberInterface() + public function testShouldImplementQueueSubscriberInterface(): void { $rc = new \ReflectionClass(ResolveCacheProcessor::class); $this->assertTrue($rc->implementsInterface(QueueSubscriberInterface::class)); } - public function testShouldSubscribeToExpectedCommand() + public function testShouldSubscribeToExpectedCommand(): void { $command = ResolveCacheProcessor::getSubscribedCommand(); - $this->assertInternalType('array', $command); + $this->assertIsArray($command); $this->assertSame([ 'command' => Commands::RESOLVE_CACHE, 'queue' => Commands::RESOLVE_CACHE, @@ -75,15 +75,15 @@ public function testShouldSubscribeToExpectedCommand() ], $command); } - public function testShouldSubscribeToExpectedQueue() + public function testShouldSubscribeToExpectedQueue(): void { $queues = ResolveCacheProcessor::getSubscribedQueues(); - $this->assertInternalType('array', $queues); + $this->assertIsArray($queues); $this->assertSame(['liip_imagine_resolve_cache'], $queues); } - public function testCouldBeConstructedWithExpectedArguments() + public function testCouldBeConstructedWithExpectedArguments(): void { $processor = new ResolveCacheProcessor( $this->createFilterManagerMock(), @@ -94,7 +94,7 @@ public function testCouldBeConstructedWithExpectedArguments() $this->assertInstanceOf(ResolveCacheProcessor::class, $processor); } - public function testShouldRejectMessagesWithInvalidJsonBody() + public function testShouldRejectMessagesWithInvalidJsonBody(): void { $processor = new ResolveCacheProcessor( $this->createFilterManagerMock(), diff --git a/Tests/Component/Console/Style/ImagineStyleTest.php b/Tests/Component/Console/Style/ImagineStyleTest.php index ed65514c8..93a45ce61 100644 --- a/Tests/Component/Console/Style/ImagineStyleTest.php +++ b/Tests/Component/Console/Style/ImagineStyleTest.php @@ -32,7 +32,7 @@ public function testText(string $format, array $replacements): void $style = $this->createImagineStyle($output = $this->createBufferedOutput()); $style->text($format, $replacements); - $this->assertContains(vsprintf($format, $replacements), $output->getBuffer()); + $this->assertStringContainsString(vsprintf($format, $replacements), $output->getBuffer()); } public static function provideTextData(): Generator @@ -51,7 +51,7 @@ public function testTextWithoutDecoration(string $format, array $replacements): $style = $this->createImagineStyle($output = $this->createBufferedOutput(), false); $style->text($format, $replacements); - $this->assertContains(strip_tags(vsprintf($format, $replacements)), $output->getBuffer()); + $this->assertStringContainsString(strip_tags(vsprintf($format, $replacements)), $output->getBuffer()); } public static function provideTextWithoutDecorationData(): Generator @@ -67,7 +67,7 @@ public function testLine(string $format, array $replacements): void $style = $this->createImagineStyle($output = $this->createBufferedOutput()); $style->line($format, $replacements); - $this->assertContains(vsprintf($format, $replacements).PHP_EOL, $output->getBuffer()); + $this->assertStringContainsString(vsprintf($format, $replacements).PHP_EOL, $output->getBuffer()); } public static function provideLineData(): Generator @@ -85,7 +85,7 @@ public function testNewline(int $newlineCount, string $separator): void $style->newline($newlineCount); $style->text($separator); - $this->assertContains(sprintf('%1$s%2$s%1$s', $separator, str_repeat(PHP_EOL, $newlineCount)), $output->getBuffer()); + $this->assertStringContainsString(sprintf('%1$s%2$s%1$s', $separator, str_repeat(PHP_EOL, $newlineCount)), $output->getBuffer()); } public static function provideNewlineData(): Generator @@ -117,7 +117,7 @@ public function testTitle(string $title, string $type = null, bool $decoration): } } - $this->assertContains($expected, $output->getBuffer()); + $this->assertStringContainsString($expected, $output->getBuffer()); } public static function provideTitleData(): Generator @@ -148,7 +148,7 @@ public function testBlockTypes(string $type, string $expectedFormat, string $for $style->{$blockMethod}($format, $replacements); $compiled = vsprintf(strip_tags($format), $replacements); - $this->assertContains(sprintf($expectedFormat, $compiled), $output->getBuffer()); + $this->assertStringContainsString(sprintf($expectedFormat, $compiled), $output->getBuffer()); } public static function provideBlockTypesData(): Generator @@ -178,11 +178,11 @@ public static function provideBlockTypesData(): Generator public function testStatus(string $status, string $fg = null, string $bg = null): void { $style = $this->createImagineStyle($output = $this->createBufferedOutput()); - $style->status($status, $fg, $bg); + $style->status($status, $fg); - $this->assertContains($fg ?: 'default', $output->getBuffer()); - $this->assertContains($bg ?: 'default', $output->getBuffer()); - $this->assertContains(sprintf('(%s)', $status), strip_tags($output->getBuffer())); + $this->assertStringContainsString($fg ?: 'default', $output->getBuffer()); + $this->assertStringContainsString($bg ?: 'default', $output->getBuffer()); + $this->assertStringContainsString(sprintf('(%s)', $status), strip_tags($output->getBuffer())); } public static function provideStatusData(): Generator @@ -204,9 +204,9 @@ public function testGroup(string $item, string $group, string $fg = null, string $style = $this->createImagineStyle($output = $this->createBufferedOutput()); $style->group($item, $group, $fg, $bg); - $this->assertContains($fg ?: 'default', $output->getBuffer()); - $this->assertContains($bg ?: 'default', $output->getBuffer()); - $this->assertContains(sprintf('%s[%s]', $item, $group), strip_tags($output->getBuffer())); + $this->assertStringContainsString($fg ?: 'default', $output->getBuffer()); + $this->assertStringContainsString($bg ?: 'default', $output->getBuffer()); + $this->assertStringContainsString(sprintf('%s[%s]', $item, $group), strip_tags($output->getBuffer())); } public static function provideGroupData(): Generator diff --git a/Tests/DependencyInjection/Compiler/AbstractCompilerPassTestCase.php b/Tests/DependencyInjection/Compiler/AbstractCompilerPassTestCase.php index 1ed1864e0..c25a2d331 100644 --- a/Tests/DependencyInjection/Compiler/AbstractCompilerPassTestCase.php +++ b/Tests/DependencyInjection/Compiler/AbstractCompilerPassTestCase.php @@ -13,6 +13,7 @@ use Liip\ImagineBundle\DependencyInjection\Compiler\AbstractCompilerPass; use Liip\ImagineBundle\Tests\AbstractTest; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -77,7 +78,7 @@ protected function createContainerBuilderMock(array $methods = [], array $defini * @param \PHPUnit_Framework_MockObject_MockObject $container * @param mixed[] ...$expectedArguments */ - protected function expectContainerLogMethodCalledOnce(\PHPUnit_Framework_MockObject_MockObject $container, ...$expectedArguments): void + protected function expectContainerLogMethodCalledOnce(MockObject $container, ...$expectedArguments): void { $expectation = $container ->expects($this->once()) diff --git a/Tests/Events/CacheResolveEventTest.php b/Tests/Events/CacheResolveEventTest.php index 2d56ddc6d..c7124e927 100644 --- a/Tests/Events/CacheResolveEventTest.php +++ b/Tests/Events/CacheResolveEventTest.php @@ -27,7 +27,7 @@ public function testShouldAllowSetPathInConstruct() { $event = new CacheResolveEvent('default_path', 'default_filter'); - $this->assertAttributeSame('default_path', 'path', $event); + $this->assertSame('default_path', $event->getPath()); } public function testShouldAllowSetPathByMethod() @@ -35,7 +35,7 @@ public function testShouldAllowSetPathByMethod() $event = new CacheResolveEvent('default_path', 'default_filter'); $event->setPath('new_path'); - $this->assertAttributeSame('new_path', 'path', $event); + $this->assertSame('new_path', $event->getPath()); } public function testShouldAllowGetPathWhichWasSetInConstruct() @@ -57,7 +57,7 @@ public function testShouldAllowSetFilterInConstruct() { $event = new CacheResolveEvent('default_path', 'default_filter'); - $this->assertAttributeSame('default_filter', 'filter', $event); + $this->assertSame('default_filter', $event->getFilter()); } public function testShouldAllowSetFilterByMethod() @@ -65,7 +65,7 @@ public function testShouldAllowSetFilterByMethod() $event = new CacheResolveEvent('default_path', 'default_filter'); $event->setFilter('new_filter'); - $this->assertAttributeSame('new_filter', 'filter', $event); + $this->assertSame('new_filter', $event->getFilter()); } public function testShouldAllowGetFilterWhichWasSetInConstruct() @@ -87,7 +87,7 @@ public function testShouldAllowSetUrlInConstruct() { $event = new CacheResolveEvent('default_path', 'default_filter', 'default_url'); - $this->assertAttributeSame('default_url', 'url', $event); + $this->assertSame('default_url', $event->getUrl()); } public function testShouldAllowSetUrlByMethod() @@ -95,7 +95,7 @@ public function testShouldAllowSetUrlByMethod() $event = new CacheResolveEvent('default_path', 'default_filter'); $event->setUrl('new_url'); - $this->assertAttributeSame('new_url', 'url', $event); + $this->assertSame('new_url', $event->getUrl()); } public function testShouldAllowGetUrlWhichWasSetInConstruct() diff --git a/Tests/Exception/Imagine/Filter/PostProcessor/InvalidOptionExceptionTest.php b/Tests/Exception/Imagine/Filter/PostProcessor/InvalidOptionExceptionTest.php index 1678f8025..ef9f8f512 100644 --- a/Tests/Exception/Imagine/Filter/PostProcessor/InvalidOptionExceptionTest.php +++ b/Tests/Exception/Imagine/Filter/PostProcessor/InvalidOptionExceptionTest.php @@ -12,7 +12,7 @@ namespace Liip\ImagineBundle\Tests\Exception\Imagine\Filter\PostProcessor; use Liip\ImagineBundle\Exception\Imagine\Filter\PostProcessor\InvalidOptionException; -use Symfony\Bundle\FrameworkBundle\Tests\TestCase; +use PHPUnit\Framework\TestCase; /** * @covers \Liip\ImagineBundle\Exception\Imagine\Filter\PostProcessor\InvalidOptionException @@ -38,7 +38,7 @@ public function testExceptionMessage(string $message, array $options, string $op { $exception = new InvalidOptionException($message, $options); - $this->assertContains(sprintf('(%s)', $message), $exception->getMessage()); - $this->assertContains(sprintf('[%s]', $optionsText), $exception->getMessage()); + $this->assertStringContainsString(sprintf('(%s)', $message), $exception->getMessage()); + $this->assertStringContainsString(sprintf('[%s]', $optionsText), $exception->getMessage()); } } diff --git a/Tests/Functional/Command/AbstractCommandTestCase.php b/Tests/Functional/Command/AbstractCommandTestCase.php index 10da012d6..f99d42832 100644 --- a/Tests/Functional/Command/AbstractCommandTestCase.php +++ b/Tests/Functional/Command/AbstractCommandTestCase.php @@ -22,7 +22,8 @@ class AbstractCommandTestCase extends AbstractSetupWebTestCase { protected function executeConsole(string $commandName, array $arguments = [], &$return = null): string { - $application = new Application($this->createClient()->getKernel()); + $kernel = static::createKernel(); + $application = new Application($kernel); $command = $application->find($commandName); $arguments = array_replace(['command' => $command->getName()], $arguments); @@ -81,7 +82,7 @@ protected function assertOutputContainsFailedImages($output, array $images, arra { foreach ($images as $i) { foreach ($filters as $f) { - $this->assertContains(sprintf('%s[%s] (failed)', $i, $f), $output); + $this->assertStringContainsString(sprintf('%s[%s] (failed)', $i, $f), $output); } } } @@ -95,7 +96,7 @@ protected function assertOutputContainsImage($output, $image, $filter, $type): v $filter, $image, ]); - $this->assertContains($expected, $output); + $this->assertStringContainsString($expected, $output); } /** diff --git a/Tests/Functional/Command/RemoveCacheCommandTest.php b/Tests/Functional/Command/RemoveCacheCommandTest.php index 6a283a55c..35b440d64 100644 --- a/Tests/Functional/Command/RemoveCacheCommandTest.php +++ b/Tests/Functional/Command/RemoveCacheCommandTest.php @@ -146,7 +146,7 @@ protected function assertOutputContainsSkippedImages($output, array $images, arr { foreach ($images as $i) { foreach ($filters as $f) { - $this->assertContains(sprintf('%s[%s] (skipped)', $i, $f), $output); + $this->assertStringContainsString(sprintf('%s[%s] (skipped)', $i, $f), $output); } } } @@ -155,7 +155,7 @@ protected function assertOutputContainsRemovedImages($output, array $images, arr { foreach ($images as $i) { foreach ($filters as $f) { - $this->assertContains(sprintf('%s[%s] (removed)', $i, $f), $output); + $this->assertStringContainsString(sprintf('%s[%s] (removed)', $i, $f), $output); } } } @@ -166,11 +166,11 @@ protected function assertOutputContainsRemovedImages($output, array $images, arr */ protected function assertOutputContainsSummary(string $output, array $images, array $filters, int $failures = 0): void { - $this->assertContains(sprintf('Completed %d removal', (count($images) * count($filters)) - $failures), $output); - $this->assertContains(sprintf('%d image', count($images)), $output); - $this->assertContains(sprintf('%d filter', count($filters)), $output); + $this->assertStringContainsString(sprintf('Completed %d removal', (count($images) * count($filters)) - $failures), $output); + $this->assertStringContainsString(sprintf('%d image', count($images)), $output); + $this->assertStringContainsString(sprintf('%d filter', count($filters)), $output); if (0 !== $failures) { - $this->assertContains(sprintf('%d failure', $failures), $output); + $this->assertStringContainsString(sprintf('%d failure', $failures), $output); } } @@ -180,11 +180,11 @@ protected function assertOutputContainsSummary(string $output, array $images, ar */ protected function assertOutputNotContainsSummary(string $output, array $images, array $filters, int $failures = 0): void { - $this->assertNotContains(sprintf('Completed %d removal', (count($images) * count($filters)) - $failures), $output); - $this->assertNotContains(sprintf('%d image', count($images)), $output); - $this->assertNotContains(sprintf('%d filter', count($filters)), $output); + $this->assertStringNotContainsString(sprintf('Completed %d removal', (count($images) * count($filters)) - $failures), $output); + $this->assertStringNotContainsString(sprintf('%d image', count($images)), $output); + $this->assertStringNotContainsString(sprintf('%d filter', count($filters)), $output); if (0 !== $failures) { - $this->assertNotContains(sprintf('%d failure', $failures), $output); + $this->assertStringNotContainsString(sprintf('%d failure', $failures), $output); } } diff --git a/Tests/Functional/Command/ResolveCacheCommandTest.php b/Tests/Functional/Command/ResolveCacheCommandTest.php index 26f0c6d6a..822f6c34c 100644 --- a/Tests/Functional/Command/ResolveCacheCommandTest.php +++ b/Tests/Functional/Command/ResolveCacheCommandTest.php @@ -172,14 +172,14 @@ public function testScriptReadableOption(): void $output = $this->executeResolveCacheCommand($images, $filters, ['--as-script' => false]); - $this->assertContains('liip/imagine-bundle', $output); + $this->assertStringContainsString('liip/imagine-bundle', $output); $this->assertOutputContainsFailedImages($output, $images, $filters); $this->assertOutputContainsSummary($output, $images, $filters, 2); $output = $this->executeResolveCacheCommand($images, $filters, ['--as-script' => true]); $this->assertImagesNotExist($images, $filters); - $this->assertNotContains('liip/imagine-bundle', $output); + $this->assertStringNotContainsString('liip/imagine-bundle', $output); $this->assertOutputContainsFailedImages($output, $images, $filters); $this->assertOutputNotContainsSummary($output, $images, $filters, 2); @@ -192,11 +192,11 @@ public function testScriptReadableOption(): void */ protected function assertOutputContainsSummary(string $output, array $images, array $filters, int $failures = 0): void { - $this->assertContains(sprintf('Completed %d resolution', (count($images) * count($filters)) - $failures), $output); - $this->assertContains(sprintf('%d image', count($images)), $output); - $this->assertContains(sprintf('%d filter', count($filters)), $output); + $this->assertStringContainsString(sprintf('Completed %d resolution', (count($images) * count($filters)) - $failures), $output); + $this->assertStringContainsString(sprintf('%d image', count($images)), $output); + $this->assertStringContainsString(sprintf('%d filter', count($filters)), $output); if (0 !== $failures) { - $this->assertContains(sprintf('%d failure', $failures), $output); + $this->assertStringContainsString(sprintf('%d failure', $failures), $output); } } @@ -206,11 +206,11 @@ protected function assertOutputContainsSummary(string $output, array $images, ar */ protected function assertOutputNotContainsSummary(string $output, array $images, array $filters, int $failures = 0): void { - $this->assertNotContains(sprintf('Completed %d resolution', (count($images) * count($filters)) - $failures), $output); - $this->assertNotContains(sprintf('%d image', count($images)), $output); - $this->assertNotContains(sprintf('%d filter', count($filters)), $output); + $this->assertStringNotContainsString(sprintf('Completed %d resolution', (count($images) * count($filters)) - $failures), $output); + $this->assertStringNotContainsString(sprintf('%d image', count($images)), $output); + $this->assertStringNotContainsString(sprintf('%d filter', count($filters)), $output); if (0 !== $failures) { - $this->assertNotContains(sprintf('%d failure', $failures), $output); + $this->assertStringNotContainsString(sprintf('%d failure', $failures), $output); } } diff --git a/Tests/Imagine/Cache/CacheManagerTest.php b/Tests/Imagine/Cache/CacheManagerTest.php index 60edc0513..356cb0824 100644 --- a/Tests/Imagine/Cache/CacheManagerTest.php +++ b/Tests/Imagine/Cache/CacheManagerTest.php @@ -658,7 +658,7 @@ public function testShouldAllowToPassChangedDataFromPreResolveEventToPostResolve $this->isInstanceOf(CacheResolveEvent::class), ImagineEvents::PRE_RESOLVE ])) - ->willReturnCallback($this->getDispatcherCallbackWithBC($dispatcher, function ($event, $name) { + ->willReturnCallback($this->getDispatcherCallbackWithBC($dispatcher, function (CacheResolveEvent $event) { $event->setPath('changed_path'); $event->setFilter('changed_filter'); })); diff --git a/Tests/Imagine/Filter/FilterConfigurationTest.php b/Tests/Imagine/Filter/FilterConfigurationTest.php index c4d9ca755..155cef77e 100644 --- a/Tests/Imagine/Filter/FilterConfigurationTest.php +++ b/Tests/Imagine/Filter/FilterConfigurationTest.php @@ -45,7 +45,7 @@ public function testReturnAllFilters() $filters = $filterConfiguration->all(); - $this->assertInternalType('array', $filters); + $this->assertIsArray($filters); $this->assertArrayHasKey('foo', $filters); $this->assertSame(['fooConfig'], $filters['foo']); @@ -90,7 +90,7 @@ public function testGetConfigSetViaConstructor() 'thumbnail' => [], ]); - $this->assertInternalType('array', $filterConfiguration->get('profile_photo')); - $this->assertInternalType('array', $filterConfiguration->get('thumbnail')); + $this->assertIsArray($filterConfiguration->get('profile_photo')); + $this->assertIsArray($filterConfiguration->get('thumbnail')); } } diff --git a/Tests/Imagine/Filter/PostProcessor/AbstractPostProcessorTestCase.php b/Tests/Imagine/Filter/PostProcessor/AbstractPostProcessorTestCase.php index e8ee715d4..414f600ab 100644 --- a/Tests/Imagine/Filter/PostProcessor/AbstractPostProcessorTestCase.php +++ b/Tests/Imagine/Filter/PostProcessor/AbstractPostProcessorTestCase.php @@ -48,11 +48,11 @@ protected function getBinaryInterfaceMock(): BinaryInterface protected function assertTemporaryFile(string $content, string $file, string $context, array $options = []): void { $this->assertFileExists($file); - $this->assertContains($context, $file); + $this->assertStringContainsString($context, $file); $this->assertSame($content, file_get_contents($file)); if (isset($options['temp_dir'])) { - $this->assertContains($options['temp_dir'], $file); + $this->assertStringContainsString($options['temp_dir'], $file); } } diff --git a/Tests/Imagine/Filter/PostProcessor/JpegOptimPostProcessorTest.php b/Tests/Imagine/Filter/PostProcessor/JpegOptimPostProcessorTest.php index c13d5ec6c..1caf9e696 100644 --- a/Tests/Imagine/Filter/PostProcessor/JpegOptimPostProcessorTest.php +++ b/Tests/Imagine/Filter/PostProcessor/JpegOptimPostProcessorTest.php @@ -149,8 +149,8 @@ public function testProcess(string $content, array $options, string $expected): $process = $this->getPostProcessorInstance(); $result = $process->process(new FileBinary($file, 'image/jpeg', 'jpeg'), $options); - $this->assertContains($expected, $result->getContent()); - $this->assertContains($content, $result->getContent()); + $this->assertStringContainsString($expected, $result->getContent()); + $this->assertStringContainsString($content, $result->getContent()); @unlink($file); } diff --git a/Tests/Imagine/Filter/PostProcessor/MozJpegPostProcessorTest.php b/Tests/Imagine/Filter/PostProcessor/MozJpegPostProcessorTest.php index 9bb74bc35..9e62fe51a 100644 --- a/Tests/Imagine/Filter/PostProcessor/MozJpegPostProcessorTest.php +++ b/Tests/Imagine/Filter/PostProcessor/MozJpegPostProcessorTest.php @@ -88,8 +88,8 @@ public function testProcess(string $content, array $options, string $expected): $process = $this->getPostProcessorInstance(); $result = $process->process(new FileBinary($file, 'image/jpeg', 'jpeg'), $options); - $this->assertContains($expected, $result->getContent()); - $this->assertContains($content, $result->getContent()); + $this->assertStringContainsString($expected, $result->getContent()); + $this->assertStringContainsString($content, $result->getContent()); @unlink($file); } diff --git a/Tests/Imagine/Filter/PostProcessor/OptiPngPostProcessorTest.php b/Tests/Imagine/Filter/PostProcessor/OptiPngPostProcessorTest.php index 45aa2ecf0..5e3616632 100644 --- a/Tests/Imagine/Filter/PostProcessor/OptiPngPostProcessorTest.php +++ b/Tests/Imagine/Filter/PostProcessor/OptiPngPostProcessorTest.php @@ -139,8 +139,8 @@ public function testProcess(string $content, array $options, string $expected) $process = $this->getPostProcessorInstance(); $result = $process->process(new FileBinary($file, 'image/png', 'png'), $options); - $this->assertContains($expected, $result->getContent()); - $this->assertContains($content, $result->getContent()); + $this->assertStringContainsString($expected, $result->getContent()); + $this->assertStringContainsString($content, $result->getContent()); @unlink($file); } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3d00787ca..8360fd847 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,12 +2,11 @@