Skip to content

Commit 21f088d

Browse files
avalanche123fabpot
authored andcommitted
[DependencyInjection] replaced assertEquals(spl_object_hash()) with assertSame
1 parent bfba386 commit 21f088d

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
2222
public function testConstructor()
2323
{
2424
$sc = new Container();
25-
$this->assertEquals(spl_object_hash($sc), spl_object_hash($sc->get('service_container')), '__construct() automatically registers itself as a service');
25+
$this->assertSame($sc, $sc->get('service_container'), '__construct() automatically registers itself as a service');
2626

2727
$sc = new Container(new ParameterBag(array('foo' => 'bar')));
2828
$this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '__construct() takes an array of parameters as its first argument');
@@ -140,7 +140,7 @@ public function testGet()
140140
$this->assertEquals($sc->__foo_baz, $sc->get('foo.baz'), '->get() returns the service if a get*Method() is defined');
141141

142142
$sc->set('bar', $bar = new \stdClass());
143-
$this->assertEquals(spl_object_hash($sc->get('bar')), spl_object_hash($bar), '->getServiceIds() prefers to return a service defined with a getXXXService() method than one defined with set()');
143+
$this->assertSame($sc->get('bar'), $bar, '->getServiceIds() prefers to return a service defined with a getXXXService() method than one defined with set()');
144144

145145
try {
146146
$sc->get(new \stdClass());

tests/Symfony/Tests/Component/DependencyInjection/DefinitionTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testConstructor()
3333
public function testSetGetConstructor()
3434
{
3535
$def = new Definition('stdClass');
36-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->setFactoryMethod('foo')), '->setFactoryMethod() implements a fluent interface');
36+
$this->assertSame($def, $def->setFactoryMethod('foo'), '->setFactoryMethod() implements a fluent interface');
3737
$this->assertEquals('foo', $def->getFactoryMethod(), '->getFactoryMethod() returns the factory method name');
3838
}
3939

@@ -52,7 +52,7 @@ public function testSetGetFactoryService()
5252
public function testSetGetClass()
5353
{
5454
$def = new Definition('stdClass');
55-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->setClass('foo')), '->setClass() implements a fluent interface');
55+
$this->assertSame($def, $def->setClass('foo'), '->setClass() implements a fluent interface');
5656
$this->assertEquals('foo', $def->getClass(), '->getClass() returns the class name');
5757
}
5858

@@ -64,9 +64,9 @@ public function testSetGetClass()
6464
public function testArguments()
6565
{
6666
$def = new Definition('stdClass');
67-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->setArguments(array('foo'))), '->setArguments() implements a fluent interface');
67+
$this->assertSame($def, $def->setArguments(array('foo')), '->setArguments() implements a fluent interface');
6868
$this->assertEquals(array('foo'), $def->getArguments(), '->getArguments() returns the arguments');
69-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->addArgument('bar')), '->addArgument() implements a fluent interface');
69+
$this->assertSame($def, $def->addArgument('bar'), '->addArgument() implements a fluent interface');
7070
$this->assertEquals(array('foo', 'bar'), $def->getArguments(), '->addArgument() adds an argument');
7171
}
7272

@@ -79,13 +79,13 @@ public function testArguments()
7979
public function testMethodCalls()
8080
{
8181
$def = new Definition('stdClass');
82-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->setMethodCalls(array(array('foo', array('foo'))))), '->setMethodCalls() implements a fluent interface');
82+
$this->assertSame($def, $def->setMethodCalls(array(array('foo', array('foo')))), '->setMethodCalls() implements a fluent interface');
8383
$this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->getMethodCalls() returns the methods to call');
84-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->addMethodCall('bar', array('bar'))), '->addMethodCall() implements a fluent interface');
84+
$this->assertSame($def, $def->addMethodCall('bar', array('bar')), '->addMethodCall() implements a fluent interface');
8585
$this->assertEquals(array(array('foo', array('foo')), array('bar', array('bar'))), $def->getMethodCalls(), '->addMethodCall() adds a method to call');
8686
$this->assertTrue($def->hasMethodCall('bar'), '->hasMethodCall() returns true if first argument is a method to call registered');
8787
$this->assertFalse($def->hasMethodCall('no_registered'), '->hasMethodCall() returns false if first argument is not a method to call registered');
88-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->removeMethodCall('bar')), '->removeMethodCall() implements a fluent interface');
88+
$this->assertSame($def, $def->removeMethodCall('bar'), '->removeMethodCall() implements a fluent interface');
8989
$this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->removeMethodCall() removes a method to call');
9090
}
9191

@@ -96,7 +96,7 @@ public function testMethodCalls()
9696
public function testSetGetFile()
9797
{
9898
$def = new Definition('stdClass');
99-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->setFile('foo')), '->setFile() implements a fluent interface');
99+
$this->assertSame($def, $def->setFile('foo'), '->setFile() implements a fluent interface');
100100
$this->assertEquals('foo', $def->getFile(), '->getFile() returns the file to include');
101101
}
102102

@@ -108,7 +108,7 @@ public function testSetIsShared()
108108
{
109109
$def = new Definition('stdClass');
110110
$this->assertTrue($def->isShared(), '->isShared() returns true by default');
111-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->setShared(false)), '->setShared() implements a fluent interface');
111+
$this->assertSame($def, $def->setShared(false), '->setShared() implements a fluent interface');
112112
$this->assertFalse($def->isShared(), '->isShared() returns false if the instance must not be shared');
113113
}
114114

@@ -119,7 +119,7 @@ public function testSetIsShared()
119119
public function testSetGetConfigurator()
120120
{
121121
$def = new Definition('stdClass');
122-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->setConfigurator('foo')), '->setConfigurator() implements a fluent interface');
122+
$this->assertSame($def, $def->setConfigurator('foo'), '->setConfigurator() implements a fluent interface');
123123
$this->assertEquals('foo', $def->getConfigurator(), '->getConfigurator() returns the configurator');
124124
}
125125

@@ -129,7 +129,7 @@ public function testSetGetConfigurator()
129129
public function testClearTags()
130130
{
131131
$def = new Definition('stdClass');
132-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->clearTags()), '->clearTags() implements a fluent interface');
132+
$this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface');
133133
$def->addTag('foo', array('foo' => 'bar'));
134134
$def->clearTags();
135135
$this->assertEquals(array(), $def->getTags(), '->clearTags() removes all current tags');
@@ -144,7 +144,7 @@ public function testTags()
144144
{
145145
$def = new Definition('stdClass');
146146
$this->assertEquals(array(), $def->getTag('foo'), '->getTag() returns an empty array if the tag is not defined');
147-
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->addTag('foo')), '->addTag() implements a fluent interface');
147+
$this->assertSame($def, $def->addTag('foo'), '->addTag() implements a fluent interface');
148148
$this->assertEquals(array(array()), $def->getTag('foo'), '->getTag() returns attributes for a tag name');
149149
$def->addTag('foo', array('foo' => 'bar'));
150150
$this->assertEquals(array(array(), array('foo' => 'bar')), $def->getTag('foo'), '->addTag() can adds the same tag several times');

0 commit comments

Comments
 (0)