From a0bfadea8d60ca2a73f0af3953042aae0b717fa5 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Mon, 5 Nov 2012 11:04:42 +0100 Subject: [PATCH] Closes #100. --- ChangeLog.markdown | 5 +++++ PHPUnit/Framework/MockObject/Generator.php | 4 ---- .../MockObject/Generator/mocked_class.tpl.dist | 8 -------- Tests/GeneratorTest.php | 10 ---------- Tests/MockObject/class.phpt | 8 -------- Tests/MockObject/class_call_parent_clone.phpt | 8 -------- Tests/MockObject/class_call_parent_constructor.phpt | 8 -------- Tests/MockObject/class_dont_call_parent_clone.phpt | 8 -------- .../MockObject/class_dont_call_parent_constructor.phpt | 8 -------- ...implementing_interface_call_parent_constructor.phpt | 8 -------- ...menting_interface_dont_call_parent_constructor.phpt | 8 -------- Tests/MockObject/class_partial.phpt | 8 -------- Tests/MockObject/interface.phpt | 8 -------- Tests/MockObject/invocation_object_clone_object.phpt | 8 -------- Tests/MockObject/invocation_static_clone_object.phpt | 8 -------- Tests/MockObject/namespaced_class.phpt | 8 -------- .../MockObject/namespaced_class_call_parent_clone.phpt | 8 -------- .../namespaced_class_call_parent_constructor.phpt | 8 -------- .../namespaced_class_dont_call_parent_clone.phpt | 8 -------- .../namespaced_class_dont_call_parent_constructor.phpt | 8 -------- ...implementing_interface_call_parent_constructor.phpt | 8 -------- ...menting_interface_dont_call_parent_constructor.phpt | 8 -------- Tests/MockObject/namespaced_class_partial.phpt | 8 -------- Tests/MockObject/namespaced_interface.phpt | 8 -------- Tests/MockObject/nonexistent_class.phpt | 8 -------- Tests/MockObject/nonexistent_class_with_namespace.phpt | 8 -------- ...t_class_with_namespace_starting_with_separator.phpt | 8 -------- Tests/MockObjectTest.php | 4 ++-- 28 files changed, 7 insertions(+), 208 deletions(-) diff --git a/ChangeLog.markdown b/ChangeLog.markdown index b55b1251..e8882d77 100644 --- a/ChangeLog.markdown +++ b/ChangeLog.markdown @@ -3,6 +3,11 @@ PHPUnit_MockObject 1.2 This is the list of changes for the PHPUnit_MockObject 1.2 release series. +PHPUnit_MockObject 1.2.2 +------------------------ + +* Fixed #100: Removed the unique mock object ID introduced in version 1.2. + PHPUnit_MockObject 1.2.1 ------------------------ diff --git a/PHPUnit/Framework/MockObject/Generator.php b/PHPUnit/Framework/MockObject/Generator.php index 45f0d22b..4fb88a68 100644 --- a/PHPUnit/Framework/MockObject/Generator.php +++ b/PHPUnit/Framework/MockObject/Generator.php @@ -247,10 +247,6 @@ protected static function getObject($code, $className, $originalClassName = '', ); } - if ($object instanceof PHPUnit_Framework_MockObject_MockObject) { - $object->__phpunit_setId(); - } - return $object; } diff --git a/PHPUnit/Framework/MockObject/Generator/mocked_class.tpl.dist b/PHPUnit/Framework/MockObject/Generator/mocked_class.tpl.dist index 5e22d7b8..0b41d1ac 100644 --- a/PHPUnit/Framework/MockObject/Generator/mocked_class.tpl.dist +++ b/PHPUnit/Framework/MockObject/Generator/mocked_class.tpl.dist @@ -2,8 +2,6 @@ { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; {clone}{mocked_methods} public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) @@ -50,11 +48,5 @@ { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } }{epilogue} diff --git a/Tests/GeneratorTest.php b/Tests/GeneratorTest.php index 1a08df3b..2ffbbc31 100644 --- a/Tests/GeneratorTest.php +++ b/Tests/GeneratorTest.php @@ -29,16 +29,6 @@ public function testGetMockGeneratorFails() $mock = PHPUnit_Framework_MockObject_Generator::getMock('StdClass', array('foo', 'foo')); } - /** - * @covers PHPUnit_Framework_MockObject_Generator::getObject - */ - public function testMockObjectHasUniqueIdSoThatTwoMockObjectsOfTheSameClassAreNotEqual() - { - $mock1 = PHPUnit_Framework_MockObject_Generator::getMock('stdClass'); - $mock2 = PHPUnit_Framework_MockObject_Generator::getMock('stdClass'); - $this->assertNotEquals($mock1, $mock2); - } - /** * @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass */ diff --git a/Tests/MockObject/class.phpt b/Tests/MockObject/class.phpt index d49607dd..bdeecb84 100644 --- a/Tests/MockObject/class.phpt +++ b/Tests/MockObject/class.phpt @@ -30,8 +30,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -126,11 +124,5 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/class_call_parent_clone.phpt b/Tests/MockObject/class_call_parent_clone.phpt index 595c8138..784031f8 100644 --- a/Tests/MockObject/class_call_parent_clone.phpt +++ b/Tests/MockObject/class_call_parent_clone.phpt @@ -26,8 +26,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -79,12 +77,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/class_call_parent_constructor.phpt b/Tests/MockObject/class_call_parent_constructor.phpt index b33988f8..f9c10401 100644 --- a/Tests/MockObject/class_call_parent_constructor.phpt +++ b/Tests/MockObject/class_call_parent_constructor.phpt @@ -26,8 +26,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -78,12 +76,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/class_dont_call_parent_clone.phpt b/Tests/MockObject/class_dont_call_parent_clone.phpt index 306dfdac..5d337bc4 100644 --- a/Tests/MockObject/class_dont_call_parent_clone.phpt +++ b/Tests/MockObject/class_dont_call_parent_clone.phpt @@ -26,8 +26,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -78,12 +76,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/class_dont_call_parent_constructor.phpt b/Tests/MockObject/class_dont_call_parent_constructor.phpt index b33988f8..f9c10401 100644 --- a/Tests/MockObject/class_dont_call_parent_constructor.phpt +++ b/Tests/MockObject/class_dont_call_parent_constructor.phpt @@ -26,8 +26,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -78,12 +76,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/class_implementing_interface_call_parent_constructor.phpt b/Tests/MockObject/class_implementing_interface_call_parent_constructor.phpt index 672415eb..66a2af86 100644 --- a/Tests/MockObject/class_implementing_interface_call_parent_constructor.phpt +++ b/Tests/MockObject/class_implementing_interface_call_parent_constructor.phpt @@ -31,8 +31,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -83,12 +81,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/class_implementing_interface_dont_call_parent_constructor.phpt b/Tests/MockObject/class_implementing_interface_dont_call_parent_constructor.phpt index 672415eb..66a2af86 100644 --- a/Tests/MockObject/class_implementing_interface_dont_call_parent_constructor.phpt +++ b/Tests/MockObject/class_implementing_interface_dont_call_parent_constructor.phpt @@ -31,8 +31,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -83,12 +81,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/class_partial.phpt b/Tests/MockObject/class_partial.phpt index 06d70c67..0720b13f 100644 --- a/Tests/MockObject/class_partial.phpt +++ b/Tests/MockObject/class_partial.phpt @@ -31,8 +31,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -105,11 +103,5 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/interface.phpt b/Tests/MockObject/interface.phpt index cae9f430..6a4c8436 100644 --- a/Tests/MockObject/interface.phpt +++ b/Tests/MockObject/interface.phpt @@ -25,8 +25,6 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -99,11 +97,5 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/invocation_object_clone_object.phpt b/Tests/MockObject/invocation_object_clone_object.phpt index b187b9a3..685bf2e8 100644 --- a/Tests/MockObject/invocation_object_clone_object.phpt +++ b/Tests/MockObject/invocation_object_clone_object.phpt @@ -32,8 +32,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -128,11 +126,5 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/invocation_static_clone_object.phpt b/Tests/MockObject/invocation_static_clone_object.phpt index 12a50395..469b0b3c 100644 --- a/Tests/MockObject/invocation_static_clone_object.phpt +++ b/Tests/MockObject/invocation_static_clone_object.phpt @@ -32,8 +32,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -128,11 +126,5 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_class.phpt b/Tests/MockObject/namespaced_class.phpt index 1eb3f95a..d63c4ceb 100644 --- a/Tests/MockObject/namespaced_class.phpt +++ b/Tests/MockObject/namespaced_class.phpt @@ -33,8 +33,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -129,11 +127,5 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_class_call_parent_clone.phpt b/Tests/MockObject/namespaced_class_call_parent_clone.phpt index 0a79d998..1531f1de 100644 --- a/Tests/MockObject/namespaced_class_call_parent_clone.phpt +++ b/Tests/MockObject/namespaced_class_call_parent_clone.phpt @@ -28,8 +28,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -81,12 +79,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_class_call_parent_constructor.phpt b/Tests/MockObject/namespaced_class_call_parent_constructor.phpt index e5ce451c..20b3bb9b 100644 --- a/Tests/MockObject/namespaced_class_call_parent_constructor.phpt +++ b/Tests/MockObject/namespaced_class_call_parent_constructor.phpt @@ -28,8 +28,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -80,12 +78,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_class_dont_call_parent_clone.phpt b/Tests/MockObject/namespaced_class_dont_call_parent_clone.phpt index 728e8721..1c800797 100644 --- a/Tests/MockObject/namespaced_class_dont_call_parent_clone.phpt +++ b/Tests/MockObject/namespaced_class_dont_call_parent_clone.phpt @@ -28,8 +28,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -80,12 +78,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_class_dont_call_parent_constructor.phpt b/Tests/MockObject/namespaced_class_dont_call_parent_constructor.phpt index e5ce451c..20b3bb9b 100644 --- a/Tests/MockObject/namespaced_class_dont_call_parent_constructor.phpt +++ b/Tests/MockObject/namespaced_class_dont_call_parent_constructor.phpt @@ -28,8 +28,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -80,12 +78,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_class_implementing_interface_call_parent_constructor.phpt b/Tests/MockObject/namespaced_class_implementing_interface_call_parent_constructor.phpt index 91449866..ffee8977 100644 --- a/Tests/MockObject/namespaced_class_implementing_interface_call_parent_constructor.phpt +++ b/Tests/MockObject/namespaced_class_implementing_interface_call_parent_constructor.phpt @@ -33,8 +33,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -85,12 +83,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt b/Tests/MockObject/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt index 91449866..ffee8977 100644 --- a/Tests/MockObject/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt +++ b/Tests/MockObject/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt @@ -33,8 +33,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -85,12 +83,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_class_partial.phpt b/Tests/MockObject/namespaced_class_partial.phpt index 65c5ece4..3bea847b 100644 --- a/Tests/MockObject/namespaced_class_partial.phpt +++ b/Tests/MockObject/namespaced_class_partial.phpt @@ -33,8 +33,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -107,11 +105,5 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/namespaced_interface.phpt b/Tests/MockObject/namespaced_interface.phpt index 35229930..077ac08a 100644 --- a/Tests/MockObject/namespaced_interface.phpt +++ b/Tests/MockObject/namespaced_interface.phpt @@ -27,8 +27,6 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, NS\Foo { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -101,11 +99,5 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, NS\Foo { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/nonexistent_class.phpt b/Tests/MockObject/nonexistent_class.phpt index 88d9ac23..f5be8d25 100644 --- a/Tests/MockObject/nonexistent_class.phpt +++ b/Tests/MockObject/nonexistent_class.phpt @@ -24,8 +24,6 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -76,11 +74,5 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/nonexistent_class_with_namespace.phpt b/Tests/MockObject/nonexistent_class_with_namespace.phpt index c12fba31..b6c8f546 100644 --- a/Tests/MockObject/nonexistent_class_with_namespace.phpt +++ b/Tests/MockObject/nonexistent_class_with_namespace.phpt @@ -30,8 +30,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -82,12 +80,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObject/nonexistent_class_with_namespace_starting_with_separator.phpt b/Tests/MockObject/nonexistent_class_with_namespace_starting_with_separator.phpt index 0ee4a88f..2e0bfb2b 100644 --- a/Tests/MockObject/nonexistent_class_with_namespace_starting_with_separator.phpt +++ b/Tests/MockObject/nonexistent_class_with_namespace_starting_with_separator.phpt @@ -30,8 +30,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { private static $__phpunit_staticInvocationMocker; private $__phpunit_invocationMocker; - private $__phpunit_id; - private static $__phpunit_nextId = 0; public function __clone() { @@ -82,12 +80,6 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject { self::$__phpunit_staticInvocationMocker = NULL; $this->__phpunit_invocationMocker = NULL; - $this->__phpunit_id = NULL; - } - - public function __phpunit_setId() - { - $this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++); } } diff --git a/Tests/MockObjectTest.php b/Tests/MockObjectTest.php index 3745c76f..b35408c3 100644 --- a/Tests/MockObjectTest.php +++ b/Tests/MockObjectTest.php @@ -327,11 +327,11 @@ public function testClonedMockObjectShouldStillEqualTheOriginal() $this->assertEquals($a, $b); } - public function testMockObjectsConstructedIndepentantlyShouldNotEqual() + public function testMockObjectsConstructedIndepentantlyShouldBeEqual() { $a = $this->getMock('stdClass'); $b = $this->getMock('stdClass'); - $this->assertNotEquals($a,$b); + $this->assertEquals($a, $b); } public function testClonedMockObjectCanBeUsedInPlaceOfOriginalOne()