PHPUnit and assertSame()
| From: | Sebastian Bergmann | Date: | Tue, 21 Dec 2004 16:37:34 +0000 |
| Subject: | PHPUnit and assertSame() | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-35200@lists.php.net to get a copy of this message | ||
In PHPUnit-1.1.0 I removed the assertSame() [1] assertion method from the
PHP 4 port of PHPUnit.
There are a couple of unit tests in PEAR that use PHPUnit and the
assertSame() method. These tests no longer work with PHPUnit-1.1.0.
However, most of these tests make false use of the assertSame() method.
For instance
$this->assertSame($err, true, 'Kd6');
should be written using assertTrue()
$this->assertTrue($err, 'Kd6');
where $err is the condition that is asserted to be TRUE and 'Kd6' the
additional message that is printed when the assertion fails.
--
[1] assertSame() checks whether or not two variables contain references
to the same object. This cannot be done in PHP 4.
--
Sebastian Bergmann http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69