PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » MDB2 » Bug #10204

Unit tests fail under PHP4

Details

Submitted2007-02-27 10:59 UTC
Fromandrew dot hill at openads dot org
Assignedquipo
StatusBogus
PackageMDB2
PHP Version4.3.11
OSCentos 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;
}