Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More test helpers

  • Loading branch information...
commit cea738d40d8d75703eabce8e9b1118c74f44fd6a 1 parent 98d38d2
@c9s authored
Showing with 48 additions and 0 deletions.
  1. +48 −0 src/PHPUnit/TestMore.php
View
48 src/PHPUnit/TestMore.php
@@ -141,6 +141,53 @@ function dir_ok($path, $msg = null)
$test->assertTrue( is_dir($path) , "Path $path is a directory." );
}
+function same_ok($e,$v)
+{
+ $test = get_testcase_object();
+ $test->assertSame($e,$v);
+}
+
+function null_ok($e)
+{
+ $test = get_testcase_object();
+ $test->assertNull($e);
+}
+
+
+/**
+ * Assert object has an attribute
+ *
+ */
+function object_attribute_ok($o,$attributeName)
+{
+ $test = get_testcase_object();
+ $test->assertNotNull($o, "object " . get_class($o) . " is not empty");
+ $test->assertObjectHasAttribute($attributeName, $o);
+}
+
+function is_empty($e,$msg = null)
+{
+ $test = get_testcase_object();
+ $test->assertEmpty($e,$msg);
+}
+
+function array_key_ok($array,$key,$msg = null)
+{
+ $test = get_testcase_object();
+ $test->assertArrayHasKey($key,$array, $msg);
+}
+
+
+/**
+ * Assert html tags
+ */
+function tag_ok($matcher,$actual, $message = '',$isHtml = true)
+{
+ $test = get_testcase_object();
+ $test->assertTag($matcher,$actual, $message, $isHtml);
+}
+
+
function dump($e)
{
var_dump($e);
@@ -148,3 +195,4 @@ function dump($e)
}
+
Please sign in to comment.
Something went wrong with that request. Please try again.