8000 Merge branch '5.3' into 5.4 · symfony/symfony@9688631 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9688631

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: fix test [HttpKernel] Throw when HttpKernel is created and the env is empty
2 parents fa7b518 + 9b3c8ff commit 9688631

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
8787

8888
public function __construct(string $environment, bool $debug)
8989
{
90-
$this->environment = $environment;
90+
if (!$this->environment = $environment) {
91+
throw new \InvalidArgumentException(sprintf('Invalid environment provided to "%s": the environment cannot be empty.', get_debug_type($this)));
92+
}
93+
9194
$this->debug = $debug;
9295
}
9396

src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ public function testConstructor()
5555
$this->assertLessThanOrEqual(microtime(true), $kernel->getStartTime());
5656
}
5757

58+
public function testEmptyEnv()
59+
{
60+
$this->expectException(\InvalidArgumentException::class);
61+
$this->expectExceptionMessage(sprintf('Invalid environment provided to "%s": the environment cannot be empty.', KernelForTest::class));
62+
63+
new KernelForTest('', false);
64+
}
65+
5866
public function testClone()
5967
{
6068
$env = 'test_env';

src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testConsumeRememberMeCookieExpired()
118118
$this->tokenProvider->expects($this->any())
119119
->method('loadTokenBySeries')
120120
->with('series1')
121-
->willReturn(new PersistentToken(InMemoryUser::class, 'wouter', 'series1', 'tokenvalue', new \DateTime('-'.(31536000 - 1).' seconds')));
121+
->willReturn(new PersistentToken(InMemoryUser::class, 'wouter', 'series1', 'tokenvalue', new \DateTime('-'.(31536000 + 1).' seconds')));
122122

123123
$this->tokenProvider->expects($this->never())->method('updateToken')->with('series1');
124124

0 commit comments

Comments
 (0)
0