Skip to content

Commit 1f30f54

Browse files
Merge branch '5.4' into 6.3
* 5.4: [Tests] Streamline [Validator] updated Romanian translation
2 parents 2ed62b3 + eb1bcaf commit 1f30f54

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Tests/Compiler/CheckTypeDeclarationsPassTest.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,15 @@ public function testProcessSuccessWhenPassingNullToOptionalThatDoesNotAcceptNull
265265

266266
public function testProcessFailsWhenPassingBadTypeToOptional()
267267
{
268-
$this->expectException(InvalidArgumentException::class);
269-
$this->expectExceptionMessage('Invalid definition for service "bar": argument 1 of "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CheckTypeDeclarationsPass\\BarOptionalArgument::__construct()" accepts "stdClass", "string" passed.');
270-
271268
$container = new ContainerBuilder();
272269

273270
$container->register('bar', BarOptionalArgument::class)
274271
->addArgument('string instead of stdClass');
275272

276-
(new CheckTypeDeclarationsPass(true))->process($container);
273+
$this->expectException(InvalidArgumentException::class);
274+
$this->expectExceptionMessage('Invalid definition for service "bar": argument 1 of "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CheckTypeDeclarationsPass\\BarOptionalArgument::__construct()" accepts "stdClass", "string" passed.');
277275

278-
$this->assertNull($container->get('bar')->foo);
276+
(new CheckTypeDeclarationsPass(true))->process($container);
279277
}
280278

281279
public function testProcessSuccessScalarType()
@@ -604,17 +602,15 @@ public function testProcessDoesNotThrowsExceptionOnValidTypes()
604602

605603
public function testProcessThrowsOnIterableTypeWhenScalarPassed()
606604
{
607-
$this->expectException(InvalidArgumentException::class);
608-
$this->expectExceptionMessage('Invalid definition for service "bar_call": argument 1 of "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CheckTypeDeclarationsPass\\BarMethodCall::setIterable()" accepts "iterable", "int" passed.');
609-
610605
$container = new ContainerBuilder();
611606

612607
$container->register('bar_call', BarMethodCall::class)
613608
->addMethodCall('setIterable', [2]);
614609

615-
(new CheckTypeDeclarationsPass(true))->process($container);
610+
$this->expectException(InvalidArgumentException::class);
611+
$this->expectExceptionMessage('Invalid definition for service "bar_call": argument 1 of "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CheckTypeDeclarationsPass\\BarMethodCall::setIterable()" accepts "iterable", "int" passed.');
616612

617-
$this->assertInstanceOf(\stdClass::class, $container->get('bar')->foo);
613+
(new CheckTypeDeclarationsPass(true))->process($container);
618614
}
619615

620616
public function testProcessResolveExpressions()

0 commit comments

Comments
 (0)