Skip to content

Commit b34536b

Browse files
Merge branch '5.1' into 5.2
* 5.1: Use createMock() and use import instead of FQCN
2 parents a607186 + 2fd8fe8 commit b34536b

40 files changed

+213
-143
lines changed

Tests/AliasTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1616
use Symfony\Component\DependencyInjection\Alias;
17+
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1718

1819
class AliasTest extends TestCase
1920
{
@@ -122,7 +123,7 @@ public function testCanOverrideDeprecation()
122123
*/
123124
public function testCannotDeprecateWithAnInvalidTemplate($message)
124125
{
125-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
126+
$this->expectException(InvalidArgumentException::class);
126127
$def = new Alias('foo');
127128
$def->setDeprecated('package', '1.1', $message);
128129
}

Tests/Compiler/AutoAliasServicePassTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
17+
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
18+
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
1719

1820
class AutoAliasServicePassTest extends TestCase
1921
{
2022
public function testProcessWithMissingParameter()
2123
{
22-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException::class);
24+
$this->expectException(ParameterNotFoundException::class);
2325
$container = new ContainerBuilder();
2426

2527
$container->register('example')
@@ -31,7 +33,7 @@ public function testProcessWithMissingParameter()
3133

3234
public function testProcessWithMissingFormat()
3335
{
34-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
36+
$this->expectException(InvalidArgumentException::class);
3537
$container = new ContainerBuilder();
3638

3739
$container->register('example')

Tests/Compiler/CheckArgumentsValidityPassTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\DependencyInjection\Compiler\CheckArgumentsValidityPass;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
17+
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1718

1819
/**
1920
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -45,7 +46,7 @@ public function testProcess()
4546
*/
4647
public function testException(array $arguments, array $methodCalls)
4748
{
48-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
49+
$this->expectException(RuntimeException::class);
4950
$container = new ContainerBuilder();
5051
$definition = $container->register('foo');
5152
$definition->setArguments($arguments);

Tests/Compiler/CheckCircularReferencesPassTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass;
1818
use Symfony\Component\DependencyInjection\Compiler\Compiler;
1919
use Symfony\Component\DependencyInjection\ContainerBuilder;
20+
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
2021
use Symfony\Component\DependencyInjection\Reference;
2122

2223
class CheckCircularReferencesPassTest extends TestCase
2324
{
2425
public function testProcess()
2526
{
26-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException::class);
27+
$this->expectException(ServiceCircularReferenceException::class);
2728
$container = new ContainerBuilder();
2829
$container->register('a')->addArgument(new Reference('b'));
2930
$container->register('b')->addArgument(new Reference('a'));
@@ -33,7 +34,7 @@ public function testProcess()
3334

3435
public function testProcessWithAliases()
3536
{
36-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException::class);
37+
$this->expectException(ServiceCircularReferenceException::class);
3738
$container = new ContainerBuilder();
3839
$container->register('a')->addArgument(new Reference('b'));
3940
$container->setAlias('b', 'c');
@@ -44,7 +45,7 @@ public function testProcessWithAliases()
4445

4546
public function testProcessWithFactory()
4647
{
47-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException::class);
48+
$this->expectException(ServiceCircularReferenceException::class);
4849
$container = new ContainerBuilder();
4950

5051
$container
@@ -60,7 +61,7 @@ public function testProcessWithFactory()
6061

6162
public function testProcessDetectsIndirectCircularReference()
6263
{
63-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException::class);
64+
$this->expectException(ServiceCircularReferenceException::class);
6465
$container = new ContainerBuilder();
6566
$container->register('a')->addArgument(new Reference('b'));
6667
$container->register('b')->addArgument(new Reference('c'));
@@ -71,7 +72,7 @@ public function testProcessDetectsIndirectCircularReference()
7172

7273
public function testProcessDetectsIndirectCircularReferenceWithFactory()
7374
{
74-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException::class);
75+
$this->expectException(ServiceCircularReferenceException::class);
7576
$container = new ContainerBuilder();
7677

7778
$container->register('a')->addArgument(new Reference('b'));
@@ -87,7 +88,7 @@ public function testProcessDetectsIndirectCircularReferenceWithFactory()
8788

8889
public function testDeepCircularReference()
8990
{
90-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException::class);
91+
$this->expectException(ServiceCircularReferenceException::class);
9192
$container = new ContainerBuilder();
9293
$container->register('a')->addArgument(new Reference('b'));
9394
$container->register('b')->addArgument(new Reference('c'));

Tests/Compiler/CheckDefinitionValidityPassTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
17+
use Symfony\Component\DependencyInjection\Exception\EnvParameterException;
1718
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1819

1920
class CheckDefinitionValidityPassTest extends TestCase
@@ -86,7 +87,7 @@ public function testInvalidTags()
8687

8788
public function testDynamicPublicServiceName()
8889
{
89-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\EnvParameterException::class);
90+
$this->expectException(EnvParameterException::class);
9091
$container = new ContainerBuilder();
9192
$env = $container->getParameterBag()->get('env(BAR)');
9293
$container->register("foo.$env", 'class')->setPublic(true);
@@ -96,7 +97,7 @@ public function testDynamicPublicServiceName()
9697

9798
public function testDynamicPublicAliasName()
9899
{
99-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\EnvParameterException::class);
100+
$this->expectException(EnvParameterException::class);
100101
$container = new ContainerBuilder();
101102
$env = $container->getParameterBag()->get('env(BAR)');
102103
$container->setAlias("foo.$env", 'class')->setPublic(true);

Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testProcess()
4141

4242
public function testProcessThrowsExceptionOnInvalidReference()
4343
{
44-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException::class);
44+
$this->expectException(ServiceNotFoundException::class);
4545
$container = new ContainerBuilder();
4646

4747
$container
@@ -54,7 +54,7 @@ public function testProcessThrowsExceptionOnInvalidReference()
5454

5555
public function testProcessThrowsExceptionOnInvalidReferenceFromInlinedDefinition()
5656
{
57-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException::class);
57+
$this->expectException(ServiceNotFoundException::class);
5858
$container = new ContainerBuilder();
5959

6060
$def = new Definition();
@@ -84,7 +84,7 @@ public function testProcessDefinitionWithBindings()
8484

8585
public function testWithErroredServiceLocator()
8686
{
87-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException::class);
87+
$this->expectException(ServiceNotFoundException::class);
8888
$this->expectExceptionMessage('The service "foo" in the container provided to "bar" has a dependency on a non-existent service "baz".');
8989
$container = new ContainerBuilder();
9090

@@ -97,7 +97,7 @@ public function testWithErroredServiceLocator()
9797

9898
public function testWithErroredHiddenService()
9999
{
100-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException::class);
100+
$this->expectException(ServiceNotFoundException::class);
101101
$this->expectExceptionMessage('The service "bar" has a dependency on a non-existent service "foo".');
102102
$container = new ContainerBuilder();
103103

0 commit comments

Comments
 (0)