From 05200f57a89ad1df2f0c2f33fd1596289e4822b2 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 13 Jul 2020 00:27:19 +0200 Subject: [PATCH 01/14] Fix PHPUnit 8.5 deprecations. --- Tests/Controller/ContainerControllerResolverTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Controller/ContainerControllerResolverTest.php b/Tests/Controller/ContainerControllerResolverTest.php index 4c4abf5aa4..ef1c82638b 100644 --- a/Tests/Controller/ContainerControllerResolverTest.php +++ b/Tests/Controller/ContainerControllerResolverTest.php @@ -232,7 +232,7 @@ public function testGetControllerOnNonUndefinedFunction($controller, $exceptionN // All this logic needs to be duplicated, since calling parent::testGetControllerOnNonUndefinedFunction will override the expected exception and not use the regex $resolver = $this->createControllerResolver(); $this->expectException($exceptionName); - $this->expectExceptionMessageRegExp($exceptionMessage); + $this->expectExceptionMessageMatches($exceptionMessage); $request = Request::create('/'); $request->attributes->set('_controller', $controller); From 4a1c6b310806adce0f299411951d06747edf9e28 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 24 Jul 2020 05:48:59 +0200 Subject: [PATCH 02/14] updated VERSION for 3.4.43 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index 7fad1ee281..e824fdcf72 100644 --- a/Kernel.php +++ b/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.43-DEV'; + const VERSION = '3.4.43'; const VERSION_ID = 30443; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; const RELEASE_VERSION = 43; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From a50959872fb69315ab98907f97ffcf65d1e86480 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 24 Jul 2020 06:07:51 +0200 Subject: [PATCH 03/14] Bump Symfony version to 3.4.44 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index e824fdcf72..1b270bfdec 100644 --- a/Kernel.php +++ b/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.43'; - const VERSION_ID = 30443; + const VERSION = '3.4.44-DEV'; + const VERSION_ID = 30444; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 43; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 44; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From a675d2bf04a9328f164910cae6e3918b295151f3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 24 Jul 2020 06:10:09 +0200 Subject: [PATCH 04/14] Update VERSION for 4.4.11 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index 6b08101e21..2efa73a375 100644 --- a/Kernel.php +++ b/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '4.4.11-DEV'; + const VERSION = '4.4.11'; const VERSION_ID = 40411; const MAJOR_VERSION = 4; const MINOR_VERSION = 4; const RELEASE_VERSION = 11; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2022'; const END_OF_LIFE = '11/2023'; From d42f9bee7d7975b0ce62413c241f714c083db84b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 24 Jul 2020 06:14:13 +0200 Subject: [PATCH 05/14] Bump Symfony version to 4.4.12 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index 2efa73a375..7c89e610fa 100644 --- a/Kernel.php +++ b/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '4.4.11'; - const VERSION_ID = 40411; + const VERSION = '4.4.12-DEV'; + const VERSION_ID = 40412; const MAJOR_VERSION = 4; const MINOR_VERSION = 4; - const RELEASE_VERSION = 11; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 12; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2022'; const END_OF_LIFE = '11/2023'; From 5e55bf35c42afc2075880e88143a0974e3aa211e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 24 Jul 2020 06:28:10 +0200 Subject: [PATCH 06/14] Bump Symfony version to 5.1.4 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index a906fdb82e..22732d9a80 100644 --- a/Kernel.php +++ b/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '5.1.3'; - const VERSION_ID = 50103; + const VERSION = '5.1.4-DEV'; + const VERSION_ID = 50104; const MAJOR_VERSION = 5; const MINOR_VERSION = 1; - const RELEASE_VERSION = 3; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 4; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2021'; const END_OF_LIFE = '01/2021'; From 6451928305b13d5f126bf3ea48aa41c76cd3ce74 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 8 Aug 2020 16:41:28 +0200 Subject: [PATCH 07/14] Modernized deprecated PHPUnit assertion calls --- .../DataCollector/ConfigDataCollectorTest.php | 4 ++-- Tests/HttpCache/HttpCacheTest.php | 20 +++++++++---------- Tests/HttpCache/HttpCacheTestCase.php | 4 ++-- Tests/KernelTest.php | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Tests/DataCollector/ConfigDataCollectorTest.php b/Tests/DataCollector/ConfigDataCollectorTest.php index a858eabe15..f2cc4fa0dd 100644 --- a/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/Tests/DataCollector/ConfigDataCollectorTest.php @@ -31,8 +31,8 @@ public function testCollect() $this->assertTrue($c->isDebug()); $this->assertSame('config', $c->getName()); $this->assertSame('testkernel', $c->getAppName()); - $this->assertRegExp('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION); - $this->assertRegExp('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION); + $this->assertMatchesRegularExpression('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION); + $this->assertMatchesRegularExpression('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION); $this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture()); $this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale()); $this->assertSame(date_default_timezone_get(), $c->getPhpTimezone()); diff --git a/Tests/HttpCache/HttpCacheTest.php b/Tests/HttpCache/HttpCacheTest.php index cac06a80e5..444db71a3e 100644 --- a/Tests/HttpCache/HttpCacheTest.php +++ b/Tests/HttpCache/HttpCacheTest.php @@ -654,7 +654,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformation() $this->assertTraceContains('miss'); $this->assertTraceContains('store'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=10/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=10/', $this->response->headers->get('Cache-Control')); $this->cacheConfig['default_ttl'] = 10; $this->request('GET', '/'); @@ -663,7 +663,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformation() $this->assertTraceContains('fresh'); $this->assertTraceNotContains('store'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=10/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=10/', $this->response->headers->get('Cache-Control')); } public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAfterTtlWasExpired() @@ -676,7 +676,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $this->assertTraceContains('miss'); $this->assertTraceContains('store'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); $this->request('GET', '/'); $this->assertHttpKernelIsNotCalled(); @@ -684,7 +684,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $this->assertTraceContains('fresh'); $this->assertTraceNotContains('store'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); // expires the cache $values = $this->getMetaStorageValues(); @@ -704,7 +704,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $this->assertTraceContains('invalid'); $this->assertTraceContains('store'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); $this->setNextResponse(); @@ -714,7 +714,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $this->assertTraceContains('fresh'); $this->assertTraceNotContains('store'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); } public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAfterTtlWasExpiredWithStatus304() @@ -727,7 +727,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $this->assertTraceContains('miss'); $this->assertTraceContains('store'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); $this->request('GET', '/'); $this->assertHttpKernelIsNotCalled(); @@ -755,7 +755,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $this->assertTraceContains('store'); $this->assertTraceNotContains('miss'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); $this->request('GET', '/'); $this->assertHttpKernelIsNotCalled(); @@ -763,7 +763,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft $this->assertTraceContains('fresh'); $this->assertTraceNotContains('store'); $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); + $this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control')); } public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirective() @@ -776,7 +776,7 @@ public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirectiv $this->assertEquals(200, $this->response->getStatusCode()); $this->assertTraceContains('miss'); $this->assertTraceNotContains('store'); - $this->assertNotRegExp('/s-maxage/', $this->response->headers->get('Cache-Control')); + $this->assertDoesNotMatchRegularExpression('/s-maxage/', $this->response->headers->get('Cache-Control')); $this->assertEquals('Hello World', $this->response->getContent()); } diff --git a/Tests/HttpCache/HttpCacheTestCase.php b/Tests/HttpCache/HttpCacheTestCase.php index 1eb4617447..3cbea5e4ee 100644 --- a/Tests/HttpCache/HttpCacheTestCase.php +++ b/Tests/HttpCache/HttpCacheTestCase.php @@ -91,7 +91,7 @@ public function assertTraceContains($trace) $traces = $this->cache->getTraces(); $traces = current($traces); - $this->assertRegExp('/'.$trace.'/', implode(', ', $traces)); + $this->assertMatchesRegularExpression('/'.$trace.'/', implode(', ', $traces)); } public function assertTraceNotContains($trace) @@ -99,7 +99,7 @@ public function assertTraceNotContains($trace) $traces = $this->cache->getTraces(); $traces = current($traces); - $this->assertNotRegExp('/'.$trace.'/', implode(', ', $traces)); + $this->assertDoesNotMatchRegularExpression('/'.$trace.'/', implode(', ', $traces)); } public function assertExceptionsAreCaught() diff --git a/Tests/KernelTest.php b/Tests/KernelTest.php index e4e2e0727b..6cbf59b9b2 100644 --- a/Tests/KernelTest.php +++ b/Tests/KernelTest.php @@ -78,7 +78,7 @@ public function testInitializeContainerClearsOldContainers() $containerDir = __DIR__.'/Fixtures/cache/custom/'.substr(\get_class($kernel->getContainer()), 0, 16); $this->assertTrue(unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta')); $this->assertFileExists($containerDir); - $this->assertFileNotExists($containerDir.'.legacy'); + $this->assertFileDoesNotExist($containerDir.'.legacy'); $kernel = new CustomProjectDirKernel(function ($container) { $container->register('foo', 'stdClass')->setPublic(true); }); $kernel->boot(); @@ -86,8 +86,8 @@ public function testInitializeContainerClearsOldContainers() $this->assertFileExists($containerDir); $this->assertFileExists($containerDir.'.legacy'); - $this->assertFileNotExists($legacyContainerDir); - $this->assertFileNotExists($legacyContainerDir.'.legacy'); + $this->assertFileDoesNotExist($legacyContainerDir); + $this->assertFileDoesNotExist($legacyContainerDir.'.legacy'); } public function testBootInitializesBundlesAndContainer() From 8ee84f9e0e1cd3ab7d0b4d4e870ef3500ed96858 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sun, 9 Aug 2020 14:16:18 +0200 Subject: [PATCH 08/14] PHPUnit's assertContains() performs strict comparisons now. --- Tests/DataCollector/RequestDataCollectorTest.php | 2 +- Tests/Profiler/FileProfilerStorageTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/DataCollector/RequestDataCollectorTest.php b/Tests/DataCollector/RequestDataCollectorTest.php index 38979bba72..9bf5bf968d 100644 --- a/Tests/DataCollector/RequestDataCollectorTest.php +++ b/Tests/DataCollector/RequestDataCollectorTest.php @@ -51,7 +51,7 @@ public function testCollect() $this->assertEquals(['name' => 'foo'], $c->getRouteParams()); $this->assertSame([], $c->getSessionAttributes()); $this->assertSame('en', $c->getLocale()); - $this->assertContains(__FILE__, $attributes->get('resource')); + $this->assertContainsEquals(__FILE__, $attributes->get('resource')); $this->assertSame('stdClass', $attributes->get('object')->getType()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getResponseHeaders()); diff --git a/Tests/Profiler/FileProfilerStorageTest.php b/Tests/Profiler/FileProfilerStorageTest.php index 7100659c4d..4e23f13b02 100644 --- a/Tests/Profiler/FileProfilerStorageTest.php +++ b/Tests/Profiler/FileProfilerStorageTest.php @@ -293,8 +293,8 @@ public function testStatusCode() $tokens = $this->storage->find('', '', 10, ''); $this->assertCount(2, $tokens); - $this->assertContains($tokens[0]['status_code'], [200, 404]); - $this->assertContains($tokens[1]['status_code'], [200, 404]); + $this->assertContains((int) $tokens[0]['status_code'], [200, 404]); + $this->assertContains((int) $tokens[1]['status_code'], [200, 404]); } public function testMultiRowIndexFile() From a031f696fc43db5f1ba97f33c1e0066a75196472 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 11 Aug 2020 09:56:31 +0200 Subject: [PATCH 09/14] stop using the deprecated at() PHPUnit matcher --- .../ContainerControllerResolverTest.php | 25 ++++------------- .../EventListener/TranslatorListenerTest.php | 28 +++++++++++-------- Tests/HttpKernelTest.php | 4 +-- Tests/KernelTest.php | 8 ++++-- 4 files changed, 30 insertions(+), 35 deletions(-) diff --git a/Tests/Controller/ContainerControllerResolverTest.php b/Tests/Controller/ContainerControllerResolverTest.php index ef1c82638b..8275154657 100644 --- a/Tests/Controller/ContainerControllerResolverTest.php +++ b/Tests/Controller/ContainerControllerResolverTest.php @@ -15,6 +15,7 @@ use Psr\Log\LoggerInterface; use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver; @@ -117,16 +118,10 @@ public function testNonConstructController() $this->expectException('LogicException'); $this->expectExceptionMessage('Controller "Symfony\Component\HttpKernel\Tests\Controller\ImpossibleConstructController" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?'); $container = $this->getMockBuilder(Container::class)->getMock(); - $container->expects($this->at(0)) + $container->expects($this->exactly(2)) ->method('has') ->with(ImpossibleConstructController::class) - ->willReturn(true) - ; - - $container->expects($this->at(1)) - ->method('has') - ->with(ImpossibleConstructController::class) - ->willReturn(false) + ->willReturnOnConsecutiveCalls(true, false) ; $container->expects($this->atLeastOnce()) @@ -181,18 +176,10 @@ public function testExceptionWhenUsingRemovedControllerService() { $this->expectException('LogicException'); $this->expectExceptionMessage('Controller "app.my_controller" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?'); - $container = $this->getMockBuilder(Container::class)->getMock(); - $container->expects($this->at(0)) - ->method('has') - ->with('app.my_controller') - ->willReturn(false) - ; - $container->expects($this->atLeastOnce()) - ->method('getRemovedIds') - ->with() - ->willReturn(['app.my_controller' => true]) - ; + $container = new ContainerBuilder(); + $container->register('app.my_controller'); + $container->removeDefinition('app.my_controller'); $resolver = $this->createControllerResolver(null, $container); diff --git a/Tests/EventListener/TranslatorListenerTest.php b/Tests/EventListener/TranslatorListenerTest.php index 77c2c1c694..79e0d6f1ac 100644 --- a/Tests/EventListener/TranslatorListenerTest.php +++ b/Tests/EventListener/TranslatorListenerTest.php @@ -45,13 +45,15 @@ public function testLocaleIsSetInOnKernelRequest() public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest() { $this->translator - ->expects($this->at(0)) + ->expects($this->exactly(2)) ->method('setLocale') - ->willThrowException(new \InvalidArgumentException()); - $this->translator - ->expects($this->at(1)) - ->method('setLocale') - ->with($this->equalTo('en')); + ->withConsecutive( + ['fr'], + ['en'] + ) + ->willReturnOnConsecutiveCalls( + $this->throwException(new \InvalidArgumentException()) + ); $event = new GetResponseEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST); $this->listener->onKernelRequest($event); @@ -82,13 +84,15 @@ public function testLocaleIsNotSetInOnKernelFinishRequestWhenParentRequestDoesNo public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest() { $this->translator - ->expects($this->at(0)) - ->method('setLocale') - ->willThrowException(new \InvalidArgumentException()); - $this->translator - ->expects($this->at(1)) + ->expects($this->exactly(2)) ->method('setLocale') - ->with($this->equalTo('en')); + ->withConsecutive( + ['fr'], + ['en'] + ) + ->willReturnOnConsecutiveCalls( + $this->throwException(new \InvalidArgumentException()) + ); $this->setMasterRequest($this->createRequest('fr')); $event = new FinishRequestEvent($this->createHttpKernel(), $this->createRequest('de'), HttpKernelInterface::SUB_REQUEST); diff --git a/Tests/HttpKernelTest.php b/Tests/HttpKernelTest.php index af81f021ed..97c58305db 100644 --- a/Tests/HttpKernelTest.php +++ b/Tests/HttpKernelTest.php @@ -314,8 +314,8 @@ public function testVerifyRequestStackPushPopDuringHandle() $request = new Request(); $stack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->setMethods(['push', 'pop'])->getMock(); - $stack->expects($this->at(0))->method('push')->with($this->equalTo($request)); - $stack->expects($this->at(1))->method('pop'); + $stack->expects($this->once())->method('push')->with($this->equalTo($request)); + $stack->expects($this->once())->method('pop'); $dispatcher = new EventDispatcher(); $kernel = $this->getHttpKernel($dispatcher, null, $stack); diff --git a/Tests/KernelTest.php b/Tests/KernelTest.php index 6cbf59b9b2..fd840bbb7b 100644 --- a/Tests/KernelTest.php +++ b/Tests/KernelTest.php @@ -15,6 +15,7 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -219,9 +220,12 @@ public function testShutdownCallsShutdownOnAllBundles() public function testShutdownGivesNullContainerToAllBundles() { $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock(); - $bundle->expects($this->at(3)) + $bundle->expects($this->exactly(2)) ->method('setContainer') - ->with(null); + ->withConsecutive( + [$this->isInstanceOf(ContainerInterface::class)], + [null] + ); $kernel = $this->getKernel(['getBundles']); $kernel->expects($this->any()) From a3d083f0152a8e30d37e01c71ee775e0c789d3a0 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Fri, 14 Aug 2020 16:49:01 +0200 Subject: [PATCH 10/14] [VarDumper] Backport handler lock when using VAR_DUMPER_FORMAT --- DataCollector/DumpDataCollector.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/DataCollector/DumpDataCollector.php b/DataCollector/DumpDataCollector.php index d9f381b3d6..4e430f8f37 100644 --- a/DataCollector/DumpDataCollector.php +++ b/DataCollector/DumpDataCollector.php @@ -235,13 +235,7 @@ public function __destruct() --$i; } - if (isset($_SERVER['VAR_DUMPER_FORMAT'])) { - $html = 'html' === $_SERVER['VAR_DUMPER_FORMAT']; - } else { - $html = !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html'); - } - - if ($html) { + if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html')) { $dumper = new HtmlDumper('php://output', $this->charset); $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]); } else { From 3ab83d293cb851b243ada91325c69ac5d4c0ded3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 17 Aug 2020 09:16:16 +0200 Subject: [PATCH 11/14] Fix CS --- DataCollector/ConfigDataCollector.php | 2 +- Tests/DataCollector/ConfigDataCollectorTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DataCollector/ConfigDataCollector.php b/DataCollector/ConfigDataCollector.php index 673bf5c5fd..5895ef37d7 100644 --- a/DataCollector/ConfigDataCollector.php +++ b/DataCollector/ConfigDataCollector.php @@ -64,7 +64,7 @@ public function collect(Request $request, Response $response, \Exception $except 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, - 'php_architecture' => PHP_INT_SIZE * 8, + 'php_architecture' => \PHP_INT_SIZE * 8, 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', 'php_timezone' => date_default_timezone_get(), 'xdebug_enabled' => \extension_loaded('xdebug'), diff --git a/Tests/DataCollector/ConfigDataCollectorTest.php b/Tests/DataCollector/ConfigDataCollectorTest.php index f2cc4fa0dd..dc455915fa 100644 --- a/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/Tests/DataCollector/ConfigDataCollectorTest.php @@ -33,7 +33,7 @@ public function testCollect() $this->assertSame('testkernel', $c->getAppName()); $this->assertMatchesRegularExpression('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION); $this->assertMatchesRegularExpression('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION); - $this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture()); + $this->assertSame(\PHP_INT_SIZE * 8, $c->getPhpArchitecture()); $this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale()); $this->assertSame(date_default_timezone_get(), $c->getPhpTimezone()); $this->assertSame(Kernel::VERSION, $c->getSymfonyVersion()); From ce729cd7e8eb1099d3e2e5370b079b84897f7611 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 17 Aug 2020 09:39:58 +0200 Subject: [PATCH 12/14] Fix CS --- Tests/Controller/ContainerControllerResolverTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Tests/Controller/ContainerControllerResolverTest.php b/Tests/Controller/ContainerControllerResolverTest.php index c029c0b5f8..c39dac3ca5 100644 --- a/Tests/Controller/ContainerControllerResolverTest.php +++ b/Tests/Controller/ContainerControllerResolverTest.php @@ -14,7 +14,6 @@ use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver; From 4b232e313f2f6e538c17c196db156c183601779a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 13 Aug 2020 19:28:52 +0200 Subject: [PATCH 13/14] stop using deprecated PHPUnit APIs --- .../EventListener/LocaleAwareListenerTest.php | 28 +++++++++++-------- Tests/KernelTest.php | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Tests/EventListener/LocaleAwareListenerTest.php b/Tests/EventListener/LocaleAwareListenerTest.php index ef3b7d1b42..0064429048 100644 --- a/Tests/EventListener/LocaleAwareListenerTest.php +++ b/Tests/EventListener/LocaleAwareListenerTest.php @@ -47,13 +47,15 @@ public function testLocaleIsSetInOnKernelRequest() public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest() { $this->localeAwareService - ->expects($this->at(0)) + ->expects($this->exactly(2)) ->method('setLocale') - ->will($this->throwException(new \InvalidArgumentException())); - $this->localeAwareService - ->expects($this->at(1)) - ->method('setLocale') - ->with($this->equalTo('en')); + ->withConsecutive( + [$this->anything()], + ['en'] + ) + ->willReturnOnConsecutiveCalls( + $this->throwException(new \InvalidArgumentException()) + ); $event = new RequestEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST); $this->listener->onKernelRequest($event); @@ -89,13 +91,15 @@ public function testLocaleIsSetToDefaultOnKernelFinishRequestWhenParentRequestDo public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest() { $this->localeAwareService - ->expects($this->at(0)) + ->expects($this->exactly(2)) ->method('setLocale') - ->will($this->throwException(new \InvalidArgumentException())); - $this->localeAwareService - ->expects($this->at(1)) - ->method('setLocale') - ->with($this->equalTo('en')); + ->withConsecutive( + [$this->anything()], + ['en'] + ) + ->willReturnOnConsecutiveCalls( + $this->throwException(new \InvalidArgumentException()) + ); $this->requestStack->push($this->createRequest('fr')); $this->requestStack->push($subRequest = $this->createRequest('de')); diff --git a/Tests/KernelTest.php b/Tests/KernelTest.php index 4d40a1b34f..b4075c98ba 100644 --- a/Tests/KernelTest.php +++ b/Tests/KernelTest.php @@ -662,7 +662,7 @@ public function getContainerClass(): string } }; - $this->assertRegExp('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*TestDebugContainer$/', $kernel->getContainerClass()); + $this->assertMatchesRegularExpression('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*TestDebugContainer$/', $kernel->getContainerClass()); } /** From f829c240113986b60fda425c2533142e88efd7c4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 31 Aug 2020 08:18:12 +0200 Subject: [PATCH 14/14] Update VERSION for 5.1.4 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index 22732d9a80..421b68d895 100644 --- a/Kernel.php +++ b/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '5.1.4-DEV'; + const VERSION = '5.1.4'; const VERSION_ID = 50104; const MAJOR_VERSION = 5; const MINOR_VERSION = 1; const RELEASE_VERSION = 4; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2021'; const END_OF_LIFE = '01/2021';