cvs: pear /MDB2/tests MDB2_function_testcase.php
| From: | Lorenzo Alberton | Date: | Mon, 17 Oct 2005 11:38:24 +0000 |
| Subject: | cvs: pear /MDB2/tests MDB2_function_testcase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35645@lists.php.net to get a copy of this message | ||
quipo Mon Oct 17 07:38:24 2005 EDT
Modified files:
/pear/MDB2/tests MDB2_function_testcase.php
Log:
expand testNow() testcase
http://cvs.php.net/diff.php/pear/MDB2/tests/MDB2_function_testcase.php?r1=1.4&r2=1.5&ty=u
Index: pear/MDB2/tests/MDB2_function_testcase.php
diff -u pear/MDB2/tests/MDB2_function_testcase.php:1.4
pear/MDB2/tests/MDB2_function_testcase.php:1.5
--- pear/MDB2/tests/MDB2_function_testcase.php:1.4 Mon Oct 17 04:17:50 2005
+++ pear/MDB2/tests/MDB2_function_testcase.php Mon Oct 17 07:38:24 2005
@@ -41,7 +41,7 @@
// | Author: Lorenzo Alberton <l dot alberton at quipo dot it> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2_function_testcase.php,v 1.4 2005/10/17 08:17:50 lsmith Exp $
+// $Id: MDB2_function_testcase.php,v 1.5 2005/10/17 11:38:24 quipo Exp $
class MDB2_Function_TestCase extends MDB2_TestCase
{
@@ -51,7 +51,7 @@
}
/**
- * Test now()
+ * Test functionTable()
*/
function testFunctionTable()
{
@@ -63,9 +63,9 @@
$query = 'SELECT 1 '.$functionTable_clause;
$result = $this->db->queryOne($query);
if (PEAR::isError($result)) {
- $this->assertFalse(true, 'Error getting substring');
+ $this->assertFalse(true, 'Error fetching from function table');
} else {
- $this->assertEquals('1', $result, 'Error: not a proper
timestamp');
+ $this->assertEquals('1', $result, 'Error fetching value from function
table');
}
}
@@ -83,10 +83,28 @@
$query = 'SELECT '.$now_clause . $functionTable_clause;
$result = $this->db->queryOne($query);
if (PEAR::isError($result)) {
- $this->assertFalse(true, 'Error getting substring');
+ $this->assertFalse(true, 'Error getting timestamp');
} else {
$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $result,
'Error: not a proper timestamp');
}
+
+ $now_clause = $this->db->function->now('date');
+ $query = 'SELECT '.$now_clause . $functionTable_clause;
+ $result = $this->db->queryOne($query);
+ if (PEAR::isError($result)) {
+ $this->assertFalse(true, 'Error getting date');
+ } else {
+ $this->assertRegExp('/\d{4}-\d{2}-\d{2}/', $result, 'Error: not a
proper date');
+ }
+
+ $now_clause = $this->db->function->now('time');
+ $query = 'SELECT '.$now_clause . $functionTable_clause;
+ $result = $this->db->queryOne($query);
+ if (PEAR::isError($result)) {
+ $this->assertFalse(true, 'Error getting time');
+ } else {
+ $this->assertRegExp('/\d{2}:\d{2}:\d{2}/', $result, 'Error: not a
proper time');
+ }
}
/**
@@ -152,7 +170,7 @@
if (PEAR::isError($result)) {
$this->assertFalse(true, 'Error getting substring');
} else {
- $this->assertEquals('timestamp', $result, 'Error: could not
concatenate "timestamp"');
+ $this->assertEquals('timestamp', $result, 'Error: could not
concatenate "time+stamp"');
}
}
}