PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2 » Bug #10190

Unit tests fail under PHP4

Details

Submitted2007-02-26 13:32 UTC
Fromandrew dot hill at openads dot org
Assignedquipo
StatusClosed
PackageMDB2
PHP Version4.3.11
OSCentos 4.3, Apache 1.3
Roadmaps(Not assigned)

Comments

[2007-02-26 13:32 UTC] andrew dot hill at openads dot org

Description:
------------
The use of __call() to capture undefined methods does not work with PHP4. This means that many of the PHPUnit tests in MDB2_Extended_TestCase [ie. testGetAssoc(), testGetOne(), testGetCol(), testGetRow()] fail.

Test script:
---------------
--- MDB2.php (revision 4657)
+++ MDB2.php (working copy)
@@ -1922,6 +1922,73 @@
}

// }}}
+ // {{{ function getAssoc($query, $types = null, $params = array())
+
+ /**
+ * A hacked in method to allow getAssoc to be called in PHP4, where
+ * it would normally be called via __call() above in PHP5.
+ *
+ * @see MDB2_Extended::getAssoc().
+ */
+ function getAssoc($query, $types = null, $params = array(),
+ $param_types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT,
+ $rekey = false, $force_array = false, $group = false)
+ {
+ $callParams = array($query, $types, $params,
+ $param_types, $fetchmode,
+ $rekey, $force_array, $group);
+ return $this->__call('getAssoc', $callParams);
+ }
+
+ // }}}
+ // {{{ function getOne($query, $type = null, $params = array())
+
+ /**
+ * A hacked in method to allow getOne to be called in PHP4, where
+ * it would normally be called via __call() above in PHP5.
+ *
+ * @see MDB2_Extended::getOne().
+ */
+ function getOne($query, $type = null, $params = array(),
+ $param_types = null, $colnum = 0)
+ {
+ $callParams = array($query, $type, $params, $param_types, $colnum);
+ return $this->__call('getOne', $callParams);
+ }
+
+ // }}}
+ // {{{ function getCol($query, $type = null, $params = array())
+
+ /**
+ * A hacked in method to allow getCol to be called in PHP4, where
+ * it would normally be called via __call() above in PHP5.
+ *
+ * @see MDB2_Extended::getCol().
+ */
+ function getCol($query, $type = null, $params = array(),
+ $param_types = null, $colnum = 0)
+ {
+ $callParams = array($query, $type, $params, $param_types, $colnum);
+ return $this->__call('getCol', $callParams);
+ }
+
+ // }}}
+ // {{{ function getRow($query, $type = null, $params = array())
+
+ /**
+ * A hacked in method to allow getRow to be called in PHP4, where
+ * it would normally be called via __call() above in PHP5.
+ *
+ * @see MDB2_Extended::getRow().
+ */
+ function getRow($query, $types = null, $params = array(),
+ $param_types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT)
+ {
+ $callParams = array($query, $types, $params, $param_types, $fetchmode);
+ return $this->__call('getRow', $callParams);
+ }
+
+ // }}}
// {{{ function beginTransaction($savepoint = null)

/**