8000 minor #21226 Fix Container and PhpDumper test inaccuracies (nikita2206) · symfony/symfony@d18c2ca · GitHub
[go: up one dir, main page]

Skip to content

Commit d18c2ca

Browse files
minor #21226 Fix Container and PhpDumper test inaccuracies (nikita2206)
This PR was merged into the 2.7 branch. Discussion ---------- Fix Container and PhpDumper test inaccuracies | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Stumbled upon and fixed some minor inaccuracies in tests for DI container, they might have lead to undetected changes of `Container`'s behavior Commits ------- 24b93cc Fix Container and PhpDumper test inaccuracies
2 parents e355739 + 24b93cc commit d18c2ca

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function testSet()
134134
{
135135
$sc = new Container();
136136
$sc->set('foo', $foo = new \stdClass());
137-
$this->assertEquals($foo, $sc->get('foo'), '->set() sets a service');
137+
$this->assertSame($foo, $sc->get('foo'), '->set() sets a service');
138138
}
139139

140140
public function testSetWithNullResetTheService()
@@ -196,15 +196,15 @@ public function testGet()
196196
{
197197
$sc = new ProjectServiceContainer();
198198
$sc->set('foo', $foo = new \stdClass());
199-
$this->assertEquals($foo, $sc->get('foo'), '->get() returns the service for the given id');
200-
$this->assertEquals($foo, $sc->get('Foo'), '->get() returns the service for the given id, and converts id to lowercase');
201-
$this->assertEquals($sc->__bar, $sc->get('bar'), '->get() returns the service for the given id');
202-
$this->assertEquals($sc->__foo_bar, $sc->get('foo_bar'), '->get() returns the service if a get*Method() is defined');
203-
$this->assertEquals($sc->__foo_baz, $sc->get('foo.baz'), '->get() returns the service if a get*Method() is defined');
204-
$this->assertEquals($sc->__foo_baz, $sc->get('foo\\baz'), '->get() returns the service if a get*Method() is defined');
199+
$this->assertSame($foo, $sc->get('foo'), '->get() returns the service for the given id');
200+
$this->assertSame($foo, $sc->get('Foo'), '->get() returns the service for the given id, and converts id to lowercase');
201+
$this->assertSame($sc->__bar, $sc->get('bar'), '->get() returns the service for the given id');
202+
$this->assertSame($sc->__foo_bar, $sc->get('foo_bar'), '->get() returns the service if a get*Method() is defined');
203+
$this->assertSame($sc->__foo_baz, $sc->get('foo.baz'), '->get() returns the service if a get*Method() is defined');
204+
$this->assertSame($sc->__foo_baz, $sc->get('foo\\baz'), '->get() returns the service if a get*Method() is defined');
205205

206206
$sc->set('bar', $bar = new \stdClass());
207-
$this->assertEquals($bar, $sc->get('bar'), '->get() prefers to return a service defined with set() than one defined with a getXXXMethod()');
207+
$this->assertSame($bar, $sc->get('bar'), '->get() prefers to return a service defined with set() than one defined with a getXXXMethod()');
208208

209209
try {
210210
$sc->get('');

src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function testOverrideServiceWhenUsingADumpedContainer()
230230
$container->set('bar', $bar = new \stdClass());
231231
$container->setParameter('foo_bar', 'foo_bar');
232232

233-
$this->assertEquals($bar, $container->get('bar'), '->set() overrides an already defined service');
233+
$this->assertSame($bar, $container->get('bar'), '->set() overrides an already defined service');
234234
}
235235

236236
public function testOverrideServiceWhenUsingADumpedContainerAndServiceIsUsedFromAnotherOne()

0 commit comments

Comments
 (0)
0