Home » Database » MDB2 » Bug #10204
Unit tests fail under PHP4
Details
| Submitted | 2007-02-27 10:59 UTC |
|---|---|
| From | andrew dot hill at openads dot org |
| Assigned | quipo |
| Status | Bogus |
| Package | MDB2 |
| PHP Version | 4.3.11 |
| OS | Centos 4.3, Apache 1.3 |
| Roadmaps | (Not assigned) |
Comments
[2007-02-27 10:59 UTC] andrew dot hill at openads dot org
Description:
------------
The MDB2_Internals_TestCase::test_quoteIdentifier() method tests that a driver's implementation of MDB2::quoteIdentifier() is correct. However, the test only sets the $identifier_quoting array's "end" and "escape" indices, and assumes that the "start" index is a backquote (i.e. "`").
However, not all drivers have a backquote for the starting quote character (e.g. the PostgreSQL driver), causing the test to fail when testing these drivers.
Test script:
---------------
Patch to fix:
--- MDB2/tests/MDB2_internals_testcase.php (revision 4672)
+++ MDB2/tests/MDB2_internals_testcase.php (working copy)
@@ -215,10 +215,11 @@
function test_quoteIdentifier()
{
$tmp = $this->db->identifier_quoting;
- $this->db->identifier_quoting['escape'] = '/';
+ $this->db->identifier_quoting['start'] = '"';
$this->db->identifier_quoting['end'] = '`';
+ $this->db->identifier_quoting['escape'] = '/';
$text = 'my`identifier';
- $this->assertEquals('`my/`identifier`', $this->db->quoteIdentifier($text), 'quoteIdentifier');
+ $this->assertEquals('"my/`identifier`', $this->db->quoteIdentifier($text), 'quoteIdentifier');
$this->db->identifier_quoting = $tmp;
}