Skip to content

Commit 7af9c5d

Browse files
author
Robin Chalas
committed
minor symfony#29792 [DependencyInjection] properly fix tests on PHP 5 (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [DependencyInjection] properly fix tests on PHP 5 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- c8ced3a properly fix tests on PHP 5
2 parents 6d84aeb + c8ced3a commit 7af9c5d

File tree

4 files changed

+41
-8
lines changed

4 files changed

+41
-8
lines changed

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Reference;
1818
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
19-
use Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy;
19+
use Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes;
2020
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy;
2121
use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy;
2222
use Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1;
@@ -119,16 +119,16 @@ public function testArgumentNotFound()
119119

120120
/**
121121
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
122-
* @expectedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1": method "Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::createTestDefinition1()" has no argument named "$notFound". Check your service definition.
122+
* @expectedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1": method "Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes::createTestDefinition1()" has no argument named "$notFound". Check your service definition.
123123
*/
124124
public function testCorrectMethodReportedInException()
125125
{
126126
$container = new ContainerBuilder();
127127

128-
$container->register(FactoryDummy::class, FactoryDummy::class);
128+
$container->register(FactoryDummyWithoutReturnTypes::class, FactoryDummyWithoutReturnTypes::class);
129129

130130
$definition = $container->register(TestDefinition1::class, TestDefinition1::class);
131-
$definition->setFactory(array(FactoryDummy::class, 'createTestDefinition1'));
131+
$definition->setFactory(array(FactoryDummyWithoutReturnTypes::class, 'createTestDefinition1'));
132132
$definition->setArguments(array('$notFound' => '123'));
133133

134134
$pass = new ResolveNamedArgumentsPass();

src/Symfony/Component/DependencyInjection/Tests/Fixtures/FactoryDummy.php

-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ public static function createSelf(): self
3333
public static function createParent(): parent
3434
{
3535
}
36-
37-
public function createTestDefinition1()
38-
{
39-
}
4036
}
4137

4238
class FactoryParent
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
13+
14+
class FactoryDummyWithoutReturnTypes
15+
{
16+
public function createTestDefinition1()
17+
{
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
13+
14+
use Symfony\Component\DependencyInjection\Definition;
15+
16+
class TestDefinition1 extends Definition
17+
{
18+
}

0 commit comments

Comments
 (0)