Details
-
Type:
Unit Tests: Improvement
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0.1
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Db_Adapter_Db2
-
Labels:None
-
Fix Version Priority:Should Have
Description
testTableInsertWithSchema() is currently failing.
It calls insert() on a Table object:
$table->insert();
Under the covers, the DB2 adapter makes 2 SQL calls: An SQL INSERT and an SQL SELECT. The SELECT is to obtain the last insert id.
The unit test uses the Profiler to determine what the last SQL statement issued looks like assuming only the INSERT statement was executed.
In the case of DB2, because the last statement issued was a SELECT, the assert comparison fails.
The solution is to obtain the first query profile, not the last one from the profiler:
$qp = $this->_db->getProfiler()->getQueryProfiles(); $tableSpec = $this->_db->quoteIdentifier($schemaName.'.'.$tableName, true); $this->assertContains("INSERT INTO $tableSpec ", $qp[0]->getQuery());
Another option is to filter query profiles in the parent TestCommon.php class using Zend_Db_Profiler, but filtering is currently not working. Please see http://framework.zend.com/issues/browse/ZF-1861
A patch for DB2Test.php will be attached.
Attachments
Issue Links
| This issue is related to: | ||||
| ZF-3072 | Support for DB2 on i5 |
|
|
|
Patch to fix failing unit test