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

Skip to content

Commit 290a97a

Browse files
Merge branch '5.4' into 6.0
* 5.4: cs fix [Console] Add more context when CommandIsSuccessful fails [HttpKernel] Backport type fixes
2 parents 9ced2b2 + 6bc0f35 commit 290a97a

File tree

7 files changed

+40
-7
lines changed

7 files changed

+40
-7
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function configureRoutes(RoutingConfigurator $routes): void
7979
$routes->add('danger', '/danger')->controller('kernel::dangerousAction');
8080
}
8181

82-
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
82+
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void
8383
{
8484
$c->register('logger', NullLogger::class);
8585
$c->loadFromExtension('framework', [

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function configureRoutes(RoutingConfigurator $routes): void
7676
$routes->add('halloween', '/')->controller([$this, 'halloweenAction']);
7777
}
7878

79-
protected function configureContainer(ContainerConfigurator $c)
79+
protected function configureContainer(ContainerConfigurator $c): void
8080
{
8181
$c->parameters()
8282
->set('halloween', 'Have a great day!');

src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ public function registerBundles(): iterable
3232
];
3333
}
3434

35-
protected function configureRoutes(RoutingConfigurator $routes)
35+
protected function configureRoutes(RoutingConfigurator $routes): void
3636
{
3737
$routes->import(__DIR__.'/../../Resources/config/routing/profiler.xml')->prefix('/_profiler');
3838
$routes->import(__DIR__.'/../../Resources/config/routing/wdt.xml')->prefix('/_wdt');
3939
$routes->add('_', '/')->controller('kernel::homepageController');
4040
}
4141

42-
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader)
42+
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
4343
{
4444
$containerBuilder->loadFromExtension('framework', [
4545
'secret' => 'foo-secret',

src/Symfony/Component/Console/Tester/Constraint/CommandIsSuccessful.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,17 @@ protected function failureDescription($other): string
3939
{
4040
return 'the command '.$this->toString();
4141
}
42+
43+
/**
44+
* {@inheritdoc}
45+
*/
46+
protected function additionalFailureDescription($other): string
47+
{
48+
$mapping = [
49+
Command::FAILURE => 'Command failed.',
50+
Command::INVALID => 'Command was invalid.',
51+
];
52+
53+
return $mapping[$other] ?? sprintf('Command returned exit status %d.', $other);
54+
}
4255
}

src/Symfony/Component/Console/Tests/Tester/Constraint/CommandIsSuccessfulTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,31 @@ public function testConstraint()
2626
$this->assertTrue($constraint->evaluate(Command::SUCCESS, '', true));
2727
$this->assertFalse($constraint->evaluate(Command::FAILURE, '', true));
2828
$this->assertFalse($constraint->evaluate(Command::INVALID, '', true));
29+
}
30+
31+
/**
32+
* @dataProvider providesUnsuccessful
33+
*/
34+
public function testUnsuccessfulCommand(string $expectedException, int $exitCode)
35+
{
36+
$constraint = new CommandIsSuccessful();
2937

3038
try {
31-
$constraint->evaluate(Command::FAILURE);
39+
$constraint->evaluate($exitCode);
3240
} catch (ExpectationFailedException $e) {
3341
$this->assertStringContainsString('Failed asserting that the command is successful.', TestFailure::exceptionToString($e));
42+
$this->assertStringContainsString($expectedException, TestFailure::exceptionToString($e));
3443

3544
return;
3645
}
3746

3847
$this->fail();
3948
}
49+
50+
public function providesUnsuccessful(): iterable
51+
{
52+
yield 'Failed' => ['Command failed.', Command::FAILURE];
53+
yield 'Invalid' => ['Command was invalid.', Command::INVALID];
54+
yield 'Exit code 3' => ['Command returned exit status 3.', 3];
55+
}
4056
}

src/Symfony/Component/HttpKernel/HttpCache/Store.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class Store implements StoreInterface
2626
{
2727
protected $root;
2828
private \SplObjectStorage $keyCache;
29+
30+
/**
31+
* @var array<string, resource>
32+
*/
2933
private array $locks = [];
3034

3135
/**

src/Symfony/Component/HttpKernel/HttpKernelBrowser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
*
2626
* @author Fabien Potencier <fabien@symfony.com>
2727
*
28-
* @method Request getRequest() A Request instance
29-
* @method Response getResponse() A Response instance
28+
* @method Request getRequest()
29+
* @method Response getResponse()
3030
*/
3131
class HttpKernelBrowser extends AbstractBrowser
3232
{

0 commit comments

Comments
 (0)
0