cvs: pear /PHPUnit2/Tests/Framework AssertTest.php
| From: | Sebastian Bergmann | Date: | Sat, 04 Mar 2006 18:47:10 +0000 |
| Subject: | cvs: pear /PHPUnit2/Tests/Framework AssertTest.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38909@lists.php.net to get a copy of this message | ||
sebastian Sat Mar 4 18:47:10 2006 UTC
Modified files:
/pear/PHPUnit2/Tests/Framework AssertTest.php
Log:
Tests for assertArrayHasKey() and assertArrayNotHasKey().
http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/Tests/Framework/AssertTest.php?r1=1.26&r2=1.27&diff_format=u
Index: pear/PHPUnit2/Tests/Framework/AssertTest.php
diff -u pear/PHPUnit2/Tests/Framework/AssertTest.php:1.26
pear/PHPUnit2/Tests/Framework/AssertTest.php:1.27
--- pear/PHPUnit2/Tests/Framework/AssertTest.php:1.26 Sun Feb 26 19:05:09 2006
+++ pear/PHPUnit2/Tests/Framework/AssertTest.php Sat Mar 4 18:47:10 2006
@@ -41,7 +41,7 @@
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.opensource.org/licenses/bsd-license.php
BSD License
- * @version CVS: $Id: AssertTest.php,v 1.26 2006/02/26 19:05:09 sebastian Exp $
+ * @version CVS: $Id: AssertTest.php,v 1.27 2006/03/04 18:47:10 sebastian Exp $
* @link http://pear.php.net/package/PHPUnit2
* @since File available since Release 2.0.0
*/
@@ -111,6 +111,66 @@
$this->fail();
}
+ public function testAssertArrayHasIntegerKey()
+ {
+ $this->assertArrayHasKey(0, array('foo'));
+
+ try {
+ $this->assertArrayHasKey(1, array('foo'));
+ }
+
+ catch (PHPUnit2_Framework_AssertionFailedError $e) {
+ return;
+ }
+
+ $this->fail();
+ }
+
+ public function testAssertArrayNotHasIntegerKey()
+ {
+ $this->assertArrayNotHasKey(1, array('foo'));
+
+ try {
+ $this->assertArrayNotHasKey(0, array('foo'));
+ }
+
+ catch (PHPUnit2_Framework_AssertionFailedError $e) {
+ return;
+ }
+
+ $this->fail();
+ }
+
+ public function testAssertArrayHasStringKey()
+ {
+ $this->assertArrayHasKey('foo', array('foo' => 'bar'));
+
+ try {
+ $this->assertArrayHasKey('bar', array('foo' =>
'bar'));
+ }
+
+ catch (PHPUnit2_Framework_AssertionFailedError $e) {
+ return;
+ }
+
+ $this->fail();
+ }
+
+ public function testAssertArrayNotHasStringKey()
+ {
+ $this->assertArrayNotHasKey('bar', array('foo' =>
'bar'));
+
+ try {
+ $this->assertArrayNotHasKey('foo', array('foo' =>
'bar'));
+ }
+
+ catch (PHPUnit2_Framework_AssertionFailedError $e) {
+ return;
+ }
+
+ $this->fail();
+ }
+
public function testAssertIteratorContainsObject()
{
$foo = new stdClass;