|
|
@@ -61,7 +61,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $childRow1,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($childRow1));
|
|
|
|
|
|
- $parentRow = $childRow1->findParentRow('Zend_Db_Table_TableAccounts');
|
|
|
+ $parentRow = $childRow1->findParentRow('My_ZendDbTable_TableAccounts');
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $parentRow,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($parentRow));
|
|
|
|
|
|
@@ -85,7 +85,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $childRow1,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($childRow1));
|
|
|
|
|
|
- $parentRow = $childRow1->findParentRow('Zend_Db_Table_TableAccounts', null, $select);
|
|
|
+ $parentRow = $childRow1->findParentRow('My_ZendDbTable_TableAccounts', null, $select);
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $parentRow,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($parentRow));
|
|
|
|
|
|
@@ -107,7 +107,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $childRow1,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($childRow1));
|
|
|
|
|
|
- $parentRow = $childRow1->findParentZend_Db_Table_TableAccounts();
|
|
|
+ $parentRow = $childRow1->findParentMy_ZendDbTable_TableAccounts();
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $parentRow,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($parentRow));
|
|
|
|
|
|
@@ -131,7 +131,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $childRow1,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($childRow1));
|
|
|
|
|
|
- $parentRow = $childRow1->findParentZend_Db_Table_TableAccounts($select);
|
|
|
+ $parentRow = $childRow1->findParentMy_ZendDbTable_TableAccounts($select);
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $parentRow,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($parentRow));
|
|
|
|
|
|
@@ -191,7 +191,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$originRows = $table->find(1);
|
|
|
$originRow1 = $originRows->current();
|
|
|
|
|
|
- $destRows = $originRow1->findManyToManyRowset('Zend_Db_Table_TableProducts', 'Zend_Db_Table_TableBugsProducts');
|
|
|
+ $destRows = $originRow1->findManyToManyRowset('My_ZendDbTable_TableProducts', 'My_ZendDbTable_TableBugsProducts');
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $destRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($destRows));
|
|
|
|
|
|
@@ -212,7 +212,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$originRows = $table->find(1);
|
|
|
$originRow1 = $originRows->current();
|
|
|
|
|
|
- $destRows = $originRow1->findManyToManyRowset('Zend_Db_Table_TableProducts', 'Zend_Db_Table_TableBugsProducts',
|
|
|
+ $destRows = $originRow1->findManyToManyRowset('My_ZendDbTable_TableProducts', 'My_ZendDbTable_TableBugsProducts',
|
|
|
null, null, $select);
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $destRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($destRows));
|
|
|
@@ -230,7 +230,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$originRows = $table->find(1);
|
|
|
$originRow1 = $originRows->current();
|
|
|
|
|
|
- $destRows = $originRow1->findZend_Db_Table_TableProductsViaZend_Db_Table_TableBugsProducts();
|
|
|
+ $destRows = $originRow1->findMy_ZendDbTable_TableProductsViaMy_ZendDbTable_TableBugsProducts();
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $destRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($destRows));
|
|
|
|
|
|
@@ -251,7 +251,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$originRows = $table->find(1);
|
|
|
$originRow1 = $originRows->current();
|
|
|
|
|
|
- $destRows = $originRow1->findZend_Db_Table_TableProductsViaZend_Db_Table_TableBugsProducts($select);
|
|
|
+ $destRows = $originRow1->findMy_ZendDbTable_TableProductsViaMy_ZendDbTable_TableBugsProducts($select);
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $destRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($destRows));
|
|
|
|
|
|
@@ -270,7 +270,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
// Use nonexistant class for destination table
|
|
|
try {
|
|
|
- $destRows = $originRow1->findManyToManyRowset('nonexistant_class', 'Zend_Db_Table_TableBugsProducts');
|
|
|
+ $destRows = $originRow1->findManyToManyRowset('nonexistant_class', 'My_ZendDbTable_TableBugsProducts');
|
|
|
$this->fail('Expected to catch Zend_Db_Table_Row_Exception for nonexistent table class');
|
|
|
} catch (Zend_Exception $e) {
|
|
|
$this->assertType('Zend_Db_Table_Exception', $e,
|
|
|
@@ -280,7 +280,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
// Use stdClass instead of table class for destination table
|
|
|
try {
|
|
|
- $destRows = $originRow1->findManyToManyRowset(new stdClass(), 'Zend_Db_Table_TableBugsProducts');
|
|
|
+ $destRows = $originRow1->findManyToManyRowset(new stdClass(), 'My_ZendDbTable_TableBugsProducts');
|
|
|
$this->fail('Expected to catch Zend_Db_Table_Row_Exception for nonexistent table class');
|
|
|
} catch (Zend_Exception $e) {
|
|
|
$this->assertType('Zend_Db_Table_Exception', $e,
|
|
|
@@ -290,7 +290,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
// Use nonexistant class for intersection table
|
|
|
try {
|
|
|
- $destRows = $originRow1->findManyToManyRowset('Zend_Db_Table_TableProducts', 'nonexistant_class');
|
|
|
+ $destRows = $originRow1->findManyToManyRowset('My_ZendDbTable_TableProducts', 'nonexistant_class');
|
|
|
$this->fail('Expected to catch Zend_Db_Table_Row_Exception for nonexistent table class');
|
|
|
} catch (Zend_Exception $e) {
|
|
|
$this->assertType('Zend_Db_Table_Exception', $e,
|
|
|
@@ -300,7 +300,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
// Use stdClass instead of table class for intersection table
|
|
|
try {
|
|
|
- $destRows = $originRow1->findManyToManyRowset('Zend_Db_Table_TableProducts', new stdClass());
|
|
|
+ $destRows = $originRow1->findManyToManyRowset('My_ZendDbTable_TableProducts', new stdClass());
|
|
|
$this->fail('Expected to catch Zend_Db_Table_Row_Exception for nonexistent table class');
|
|
|
} catch (Zend_Exception $e) {
|
|
|
$this->assertType('Zend_Db_Table_Exception', $e,
|
|
|
@@ -321,7 +321,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($parentRows));
|
|
|
$parentRow1 = $parentRows->current();
|
|
|
|
|
|
- $childRows = $parentRow1->findDependentRowset('Zend_Db_Table_TableBugsProducts');
|
|
|
+ $childRows = $parentRow1->findDependentRowset('My_ZendDbTable_TableBugsProducts');
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $childRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($childRows));
|
|
|
|
|
|
@@ -349,7 +349,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($parentRows));
|
|
|
$parentRow1 = $parentRows->current();
|
|
|
|
|
|
- $childRows = $parentRow1->findDependentRowset('Zend_Db_Table_TableBugsProducts', null, $select);
|
|
|
+ $childRows = $parentRow1->findDependentRowset('My_ZendDbTable_TableBugsProducts', null, $select);
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $childRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($childRows));
|
|
|
|
|
|
@@ -370,7 +370,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$parentRows = $table->find(1);
|
|
|
$parentRow1 = $parentRows->current();
|
|
|
|
|
|
- $childRows = $parentRow1->findZend_Db_Table_TableBugsProducts();
|
|
|
+ $childRows = $parentRow1->findMy_ZendDbTable_TableBugsProducts();
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $childRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($childRows));
|
|
|
|
|
|
@@ -395,7 +395,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$parentRows = $table->find(1);
|
|
|
$parentRow1 = $parentRows->current();
|
|
|
|
|
|
- $childRows = $parentRow1->findZend_Db_Table_TableBugsProducts($select);
|
|
|
+ $childRows = $parentRow1->findMy_ZendDbTable_TableBugsProducts($select);
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $childRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($childRows));
|
|
|
|
|
|
@@ -442,14 +442,14 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipCascadingUpdateUsageBasicString()
|
|
|
{
|
|
|
- $bug = $this->_getTable('Zend_Db_Table_TableBugsCustom')
|
|
|
+ $bug = $this->_getTable('My_ZendDbTable_TableBugsCustom')
|
|
|
->find(1)
|
|
|
->current();
|
|
|
$bug_id = $this->_db->foldCase('bug_id');
|
|
|
|
|
|
$this->assertEquals(
|
|
|
3,
|
|
|
- count($bugProducts = $bug->findDependentRowset('Zend_Db_Table_TableBugsProductsCustom')),
|
|
|
+ count($bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')),
|
|
|
'Expecting to find three dependent rows'
|
|
|
);
|
|
|
|
|
|
@@ -459,7 +459,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
3,
|
|
|
- count($bugProducts = $bug->findDependentRowset('Zend_Db_Table_TableBugsProductsCustom')),
|
|
|
+ count($bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')),
|
|
|
'Expecting to find three dependent rows'
|
|
|
);
|
|
|
|
|
|
@@ -473,7 +473,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
3,
|
|
|
- count($bugProducts = $bug->findDependentRowset('Zend_Db_Table_TableBugsProductsCustom')),
|
|
|
+ count($bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')),
|
|
|
'Expecting to find three dependent rows'
|
|
|
);
|
|
|
|
|
|
@@ -489,7 +489,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipCascadingUpdateUsageBasicArray()
|
|
|
{
|
|
|
- $account1 = $this->_getTable('Zend_Db_Table_TableAccountsCustom')
|
|
|
+ $account1 = $this->_getTable('My_ZendDbTable_TableAccountsCustom')
|
|
|
->find('mmouse')
|
|
|
->current();
|
|
|
$account_name = $this->_db->foldCase('account_name');
|
|
|
@@ -497,7 +497,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- count($account1->findDependentRowset('Zend_Db_Table_TableBugsCustom')),
|
|
|
+ count($account1->findDependentRowset('My_ZendDbTable_TableBugsCustom')),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
|
|
|
@@ -507,7 +507,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- count($account1Bugs = $account1->findDependentRowset('Zend_Db_Table_TableBugsCustom')),
|
|
|
+ count($account1Bugs = $account1->findDependentRowset('My_ZendDbTable_TableBugsCustom')),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
|
|
|
@@ -521,7 +521,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- count($account1Bugs = $account1->findDependentRowset('Zend_Db_Table_TableBugsCustom')),
|
|
|
+ count($account1Bugs = $account1->findDependentRowset('My_ZendDbTable_TableBugsCustom')),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
|
|
|
@@ -537,13 +537,13 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipCascadingUpdateUsageInvalidNoop()
|
|
|
{
|
|
|
- $product1 = $this->_getTable('Zend_Db_Table_TableProductsCustom')
|
|
|
+ $product1 = $this->_getTable('My_ZendDbTable_TableProductsCustom')
|
|
|
->find(1)
|
|
|
->current();
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- count($product1->findDependentRowset('Zend_Db_Table_TableBugsProductsCustom')),
|
|
|
+ count($product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
|
|
|
@@ -554,7 +554,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
0,
|
|
|
- count($product1BugsProducts = $product1->findDependentRowset('Zend_Db_Table_TableBugsProductsCustom')),
|
|
|
+ count($product1BugsProducts = $product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
|
|
|
@@ -564,7 +564,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- count($product1BugsProducts = $product1->findDependentRowset('Zend_Db_Table_TableBugsProductsCustom')),
|
|
|
+ count($product1BugsProducts = $product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
|
|
|
@@ -580,13 +580,13 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipCascadingDeleteUsageBasicString()
|
|
|
{
|
|
|
- $bug1 = $this->_getTable('Zend_Db_Table_TableBugsCustom')
|
|
|
+ $bug1 = $this->_getTable('My_ZendDbTable_TableBugsCustom')
|
|
|
->find(1)
|
|
|
->current();
|
|
|
|
|
|
$this->assertEquals(
|
|
|
3,
|
|
|
- count($bug1->findDependentRowset('Zend_Db_Table_TableBugsProductsCustom')),
|
|
|
+ count($bug1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')),
|
|
|
'Expecting to find three dependent rows'
|
|
|
);
|
|
|
|
|
|
@@ -596,7 +596,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
0,
|
|
|
- count($this->_getTable('Zend_Db_Table_TableBugsProductsCustom')->fetchAll("$bug_id = 1")),
|
|
|
+ count($this->_getTable('My_ZendDbTable_TableBugsProductsCustom')->fetchAll("$bug_id = 1")),
|
|
|
'Expecting cascading delete to have reduced dependent rows to zero'
|
|
|
);
|
|
|
}
|
|
|
@@ -610,19 +610,19 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
{
|
|
|
$reported_by = $this->_db->quoteIdentifier('reported_by', true);
|
|
|
|
|
|
- $account1 = $this->_getTable('Zend_Db_Table_TableAccountsCustom')
|
|
|
+ $account1 = $this->_getTable('My_ZendDbTable_TableAccountsCustom')
|
|
|
->find('mmouse')
|
|
|
->current();
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- count($account1->findDependentRowset('Zend_Db_Table_TableBugsCustom')),
|
|
|
+ count($account1->findDependentRowset('My_ZendDbTable_TableBugsCustom')),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
|
|
|
$account1->delete();
|
|
|
|
|
|
- $tableBugsCustom = $this->_getTable('Zend_Db_Table_TableBugsCustom');
|
|
|
+ $tableBugsCustom = $this->_getTable('My_ZendDbTable_TableBugsCustom');
|
|
|
|
|
|
$this->assertEquals(
|
|
|
0,
|
|
|
@@ -643,13 +643,13 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipCascadingDeleteUsageInvalidNoop()
|
|
|
{
|
|
|
- $product1 = $this->_getTable('Zend_Db_Table_TableProductsCustom')
|
|
|
+ $product1 = $this->_getTable('My_ZendDbTable_TableProductsCustom')
|
|
|
->find(1)
|
|
|
->current();
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- count($product1->findDependentRowset('Zend_Db_Table_TableBugsProductsCustom')),
|
|
|
+ count($product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
|
|
|
@@ -659,7 +659,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- count($this->_getTable('Zend_Db_Table_TableBugsProductsCustom')->fetchAll("$product_id = 1")),
|
|
|
+ count($this->_getTable('My_ZendDbTable_TableBugsProductsCustom')->fetchAll("$product_id = 1")),
|
|
|
'Expecting to find one dependent row'
|
|
|
);
|
|
|
}
|
|
|
@@ -668,7 +668,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
{
|
|
|
$table = $this->_table['bugs'];
|
|
|
|
|
|
- $map = $table->getReference('Zend_Db_Table_TableAccounts', 'Reporter');
|
|
|
+ $map = $table->getReference('My_ZendDbTable_TableAccounts', 'Reporter');
|
|
|
|
|
|
$this->assertThat($map, $this->arrayHasKey('columns'));
|
|
|
$this->assertThat($map, $this->arrayHasKey('refTableClass'));
|
|
|
@@ -680,7 +680,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$table = $this->_table['bugs'];
|
|
|
|
|
|
try {
|
|
|
- $table->getReference('Zend_Db_Table_TableAccounts', 'Nonexistent');
|
|
|
+ $table->getReference('My_ZendDbTable_TableAccounts', 'Nonexistent');
|
|
|
$this->fail('Expected to catch Zend_Db_Table_Exception for nonexistent reference rule');
|
|
|
} catch (Zend_Exception $e) {
|
|
|
$this->assertType('Zend_Db_Table_Exception', $e,
|
|
|
@@ -712,7 +712,9 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipFindParentRowCustomInstance()
|
|
|
{
|
|
|
- $myRowClass = 'Zend_Db_Table_Row_TestMyRow';
|
|
|
+ $this->_useMyIncludePath();
|
|
|
+
|
|
|
+ $myRowClass = 'My_ZendDbTable_Row_TestMyRow';
|
|
|
|
|
|
Zend_Loader::loadClass($myRowClass);
|
|
|
|
|
|
@@ -733,16 +735,18 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipFindParentRowCustomClass()
|
|
|
{
|
|
|
- $myRowClass = 'Zend_Db_Table_Row_TestMyRow';
|
|
|
+ $this->_useMyIncludePath();
|
|
|
+
|
|
|
+ $myRowClass = 'My_ZendDbTable_Row_TestMyRow';
|
|
|
|
|
|
Zend_Loader::loadClass($myRowClass);
|
|
|
|
|
|
- Zend_Loader::loadClass('Zend_Db_Table_TableAccountsCustom');
|
|
|
+ Zend_Loader::loadClass('My_ZendDbTable_TableAccountsCustom');
|
|
|
|
|
|
- $bug1Reporter = $this->_getTable('Zend_Db_Table_TableBugsCustom')
|
|
|
+ $bug1Reporter = $this->_getTable('My_ZendDbTable_TableBugsCustom')
|
|
|
->find(1)
|
|
|
->current()
|
|
|
- ->findParentRow(new Zend_Db_Table_TableAccountsCustom(array('db' => $this->_db)));
|
|
|
+ ->findParentRow(new My_ZendDbTable_TableAccountsCustom(array('db' => $this->_db)));
|
|
|
|
|
|
$this->assertType($myRowClass, $bug1Reporter,
|
|
|
"Expecting object of type $myRowClass, got ".get_class($bug1Reporter));
|
|
|
@@ -756,8 +760,10 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipFindDependentRowsetCustomInstance()
|
|
|
{
|
|
|
- $myRowsetClass = 'Zend_Db_Table_Rowset_TestMyRowset';
|
|
|
- $myRowClass = 'Zend_Db_Table_Row_TestMyRow';
|
|
|
+ $this->_useMyIncludePath();
|
|
|
+
|
|
|
+ $myRowsetClass = 'My_ZendDbTable_Rowset_TestMyRowset';
|
|
|
+ $myRowClass = 'My_ZendDbTable_Row_TestMyRow';
|
|
|
|
|
|
Zend_Loader::loadClass($myRowsetClass);
|
|
|
|
|
|
@@ -791,16 +797,18 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipFindDependentRowsetCustomClass()
|
|
|
{
|
|
|
- $myRowsetClass = 'Zend_Db_Table_Rowset_TestMyRowset';
|
|
|
- $myRowClass = 'Zend_Db_Table_Row_TestMyRow';
|
|
|
+ $this->_useMyIncludePath();
|
|
|
+
|
|
|
+ $myRowsetClass = 'My_ZendDbTable_Rowset_TestMyRowset';
|
|
|
+ $myRowClass = 'My_ZendDbTable_Row_TestMyRow';
|
|
|
|
|
|
Zend_Loader::loadClass($myRowsetClass);
|
|
|
|
|
|
$account_name = $this->_db->quoteIdentifier('account_name', true);
|
|
|
|
|
|
- $bugs = $this->_getTable('Zend_Db_Table_TableAccountsCustom')
|
|
|
+ $bugs = $this->_getTable('My_ZendDbTable_TableAccountsCustom')
|
|
|
->fetchRow($this->_db->quoteInto("$account_name = ?", 'mmouse'))
|
|
|
- ->findDependentRowset('Zend_Db_Table_TableBugsCustom', 'Engineer');
|
|
|
+ ->findDependentRowset('My_ZendDbTable_TableBugsCustom', 'Engineer');
|
|
|
|
|
|
$this->assertType($myRowsetClass, $bugs,
|
|
|
"Expecting object of type $myRowsetClass, got ".get_class($bugs));
|
|
|
@@ -821,8 +829,10 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipFindManyToManyRowsetCustomInstance()
|
|
|
{
|
|
|
- $myRowsetClass = 'Zend_Db_Table_Rowset_TestMyRowset';
|
|
|
- $myRowClass = 'Zend_Db_Table_Row_TestMyRow';
|
|
|
+ $this->_useMyIncludePath();
|
|
|
+
|
|
|
+ $myRowsetClass = 'My_ZendDbTable_Rowset_TestMyRowset';
|
|
|
+ $myRowClass = 'My_ZendDbTable_Row_TestMyRow';
|
|
|
|
|
|
Zend_Loader::loadClass($myRowsetClass);
|
|
|
|
|
|
@@ -833,7 +843,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$this->_table['products']
|
|
|
->setRowsetClass($myRowsetClass)
|
|
|
->setRowClass($myRowClass),
|
|
|
- 'Zend_Db_Table_TableBugsProducts'
|
|
|
+ 'My_ZendDbTable_TableBugsProducts'
|
|
|
);
|
|
|
|
|
|
$this->assertType($myRowsetClass, $bug1Products,
|
|
|
@@ -855,17 +865,19 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
*/
|
|
|
public function testTableRelationshipFindManyToManyRowsetCustomClass()
|
|
|
{
|
|
|
- $myRowsetClass = 'Zend_Db_Table_Rowset_TestMyRowset';
|
|
|
- $myRowClass = 'Zend_Db_Table_Row_TestMyRow';
|
|
|
+ $this->_useMyIncludePath();
|
|
|
+
|
|
|
+ $myRowsetClass = 'My_ZendDbTable_Rowset_TestMyRowset';
|
|
|
+ $myRowClass = 'My_ZendDbTable_Row_TestMyRow';
|
|
|
|
|
|
Zend_Loader::loadClass($myRowsetClass);
|
|
|
|
|
|
- $bug1Products = $this->_getTable('Zend_Db_Table_TableBugsCustom')
|
|
|
+ $bug1Products = $this->_getTable('My_ZendDbTable_TableBugsCustom')
|
|
|
->find(1)
|
|
|
->current()
|
|
|
->findManyToManyRowset(
|
|
|
- 'Zend_Db_Table_TableProductsCustom',
|
|
|
- 'Zend_Db_Table_TableBugsProductsCustom'
|
|
|
+ 'My_ZendDbTable_TableProductsCustom',
|
|
|
+ 'My_ZendDbTable_TableBugsProductsCustom'
|
|
|
);
|
|
|
|
|
|
$this->assertType($myRowsetClass, $bug1Products,
|
|
|
@@ -899,7 +911,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $childRow1,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($childRow1));
|
|
|
|
|
|
- $parentRow = $childRow1->findParentRow('Zend_Db_Table_TableAccounts');
|
|
|
+ $parentRow = $childRow1->findParentRow('My_ZendDbTable_TableAccounts');
|
|
|
$this->assertType('Zend_Db_Table_Row_Abstract', $parentRow,
|
|
|
'Expecting object of type Zend_Db_Table_Row_Abstract, got '.get_class($parentRow));
|
|
|
|
|
|
@@ -936,7 +948,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($parentRows));
|
|
|
$parentRow1 = $parentRows->current();
|
|
|
|
|
|
- $childRows = $parentRow1->findDependentRowset('Zend_Db_Table_TableBugs');
|
|
|
+ $childRows = $parentRow1->findDependentRowset('My_ZendDbTable_TableBugs');
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $childRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($childRows));
|
|
|
|
|
|
@@ -977,7 +989,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$originRows = $table->find(1);
|
|
|
$originRow1 = $originRows->current();
|
|
|
|
|
|
- $destRows = $originRow1->findManyToManyRowset('Zend_Db_Table_TableProducts', 'Zend_Db_Table_TableBugsProducts');
|
|
|
+ $destRows = $originRow1->findManyToManyRowset('My_ZendDbTable_TableProducts', 'My_ZendDbTable_TableBugsProducts');
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $destRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($destRows));
|
|
|
|
|
|
@@ -1006,10 +1018,10 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$refMap = array(
|
|
|
'Reporter' => array(
|
|
|
'columns' => array('reported_by'),
|
|
|
- 'refTableClass' => 'Zend_Db_Table_TableAccounts'
|
|
|
+ 'refTableClass' => 'My_ZendDbTable_TableAccounts'
|
|
|
)
|
|
|
);
|
|
|
- $table = $this->_getTable('Zend_Db_Table_TableSpecial',
|
|
|
+ $table = $this->_getTable('My_ZendDbTable_TableSpecial',
|
|
|
array(
|
|
|
'name' => 'zfbugs',
|
|
|
'referenceMap' => $refMap
|
|
|
@@ -1017,45 +1029,11 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
);
|
|
|
|
|
|
$bug1 = $table->find(1)->current();
|
|
|
- $reporter = $bug1->findParentRow('Zend_Db_Table_TableAccounts');
|
|
|
+ $reporter = $bug1->findParentRow('My_ZendDbTable_TableAccounts');
|
|
|
$this->assertEquals(array('account_name' => 'goofy'), $reporter->toArray());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Create database table based on BUGS_PRODUCTS bug with alternative
|
|
|
- * spellings of column names. Then create a Table class for this
|
|
|
- * physical table and return it.
|
|
|
- */
|
|
|
- protected function _getBugsProductsWithDissimilarColumns()
|
|
|
- {
|
|
|
- $altCols = array(
|
|
|
- 'boog_id' => 'INTEGER NOT NULL',
|
|
|
- 'produck_id' => 'INTEGER NOT NULL',
|
|
|
- 'PRIMARY KEY' => 'boog_id,produck_id'
|
|
|
- );
|
|
|
- $this->_util->createTable('AltBugsProducts', $altCols);
|
|
|
- $altBugsProducts = $this->_db->quoteIdentifier($this->_db->foldCase('zfalt_bugs_products'), true);
|
|
|
- $bugsProducts = $this->_db->quoteIdentifier($this->_db->foldCase('zfbugs_products'), true);
|
|
|
- $this->_db->query("INSERT INTO $altBugsProducts SELECT * FROM $bugsProducts");
|
|
|
-
|
|
|
- $refMap = array(
|
|
|
- 'Boog' => array(
|
|
|
- 'columns' => array('boog_id'),
|
|
|
- 'refTableClass' => 'Zend_Db_Table_TableBugs',
|
|
|
- 'refColumns' => array('bug_id')
|
|
|
- ),
|
|
|
- 'Produck' => array(
|
|
|
- 'columns' => array('produck_id'),
|
|
|
- 'refTableClass' => 'Zend_Db_Table_TableProducts',
|
|
|
- 'refColumns' => array('product_id')
|
|
|
- )
|
|
|
- );
|
|
|
- $options = array('name' => 'zfalt_bugs_products', 'referenceMap' => $refMap);
|
|
|
- $table = $this->_getTable('Zend_Db_Table_TableSpecial', $options);
|
|
|
- return $table;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* Test that findParentRow() works even if the column names are
|
|
|
* not the same.
|
|
|
*/
|
|
|
@@ -1067,10 +1045,10 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$intersectionTable = $this->_getBugsProductsWithDissimilarColumns();
|
|
|
$intRow = $intersectionTable->find(2, 3)->current();
|
|
|
|
|
|
- $bugRow = $intRow->findParentRow('Zend_Db_Table_TableBugs');
|
|
|
+ $bugRow = $intRow->findParentRow('My_ZendDbTable_TableBugs');
|
|
|
$this->assertEquals(2, $bugRow->$bug_id);
|
|
|
|
|
|
- $productRow = $intRow->findParentRow('Zend_Db_Table_TableProducts');
|
|
|
+ $productRow = $intRow->findParentRow('My_ZendDbTable_TableProducts');
|
|
|
$this->assertEquals(3, $productRow->$product_id);
|
|
|
}
|
|
|
|
|
|
@@ -1081,7 +1059,7 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
public function testTableRelationshipFindDependentRowsetWithDissimilarColumns()
|
|
|
{
|
|
|
$intersectionTable = $this->_getBugsProductsWithDissimilarColumns();
|
|
|
- $bugsTable = $this->_getTable('Zend_Db_Table_TableBugs');
|
|
|
+ $bugsTable = $this->_getTable('My_ZendDbTable_TableBugs');
|
|
|
$bugRow = $bugsTable->find(2)->current();
|
|
|
|
|
|
$intRows = $bugRow->findDependentRowset($intersectionTable);
|
|
|
@@ -1097,10 +1075,10 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$product_id = $this->_db->foldCase('product_id');
|
|
|
|
|
|
$intersectionTable = $this->_getBugsProductsWithDissimilarColumns();
|
|
|
- $bugsTable = $this->_getTable('Zend_Db_Table_TableBugs');
|
|
|
+ $bugsTable = $this->_getTable('My_ZendDbTable_TableBugs');
|
|
|
$bugRow = $bugsTable->find(2)->current();
|
|
|
|
|
|
- $productRows = $bugRow->findManyToManyRowset('Zend_Db_Table_TableProducts', $intersectionTable);
|
|
|
+ $productRows = $bugRow->findManyToManyRowset('My_ZendDbTable_TableProducts', $intersectionTable);
|
|
|
$this->assertEquals(3, $productRows->current()->$product_id);
|
|
|
}
|
|
|
|
|
|
@@ -1115,11 +1093,54 @@ abstract class Zend_Db_Table_Relationships_TestCommon extends Zend_Db_Table_Test
|
|
|
$originRows = $table->find(1);
|
|
|
$originRow1 = $originRows->current();
|
|
|
|
|
|
- $destRows = $originRow1->findManyToManyRowset('Zend_Db_Table_TableBugs', 'Zend_Db_Table_TableBugsProducts');
|
|
|
+ $destRows = $originRow1->findManyToManyRowset('My_ZendDbTable_TableBugs', 'My_ZendDbTable_TableBugsProducts');
|
|
|
$this->assertType('Zend_Db_Table_Rowset_Abstract', $destRows,
|
|
|
'Expecting object of type Zend_Db_Table_Rowset_Abstract, got '.get_class($destRows));
|
|
|
|
|
|
$this->assertEquals(1, $destRows->count());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Utility Methods Below
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create database table based on BUGS_PRODUCTS bug with alternative
|
|
|
+ * spellings of column names. Then create a Table class for this
|
|
|
+ * physical table and return it.
|
|
|
+ */
|
|
|
+ protected function _getBugsProductsWithDissimilarColumns()
|
|
|
+ {
|
|
|
+ $altCols = array(
|
|
|
+ 'boog_id' => 'INTEGER NOT NULL',
|
|
|
+ 'produck_id' => 'INTEGER NOT NULL',
|
|
|
+ 'PRIMARY KEY' => 'boog_id,produck_id'
|
|
|
+ );
|
|
|
+ $this->_util->createTable('AltBugsProducts', $altCols);
|
|
|
+ $altBugsProducts = $this->_db->quoteIdentifier($this->_db->foldCase('zfalt_bugs_products'), true);
|
|
|
+ $bugsProducts = $this->_db->quoteIdentifier($this->_db->foldCase('zfbugs_products'), true);
|
|
|
+ $this->_db->query("INSERT INTO $altBugsProducts SELECT * FROM $bugsProducts");
|
|
|
+
|
|
|
+ $refMap = array(
|
|
|
+ 'Boog' => array(
|
|
|
+ 'columns' => array('boog_id'),
|
|
|
+ 'refTableClass' => 'My_ZendDbTable_TableBugs',
|
|
|
+ 'refColumns' => array('bug_id')
|
|
|
+ ),
|
|
|
+ 'Produck' => array(
|
|
|
+ 'columns' => array('produck_id'),
|
|
|
+ 'refTableClass' => 'My_ZendDbTable_TableProducts',
|
|
|
+ 'refColumns' => array('product_id')
|
|
|
+ )
|
|
|
+ );
|
|
|
+ $options = array('name' => 'zfalt_bugs_products', 'referenceMap' => $refMap);
|
|
|
+ $table = $this->_getTable('My_ZendDbTable_TableSpecial', $options);
|
|
|
+ return $table;
|
|
|
+ }
|
|
|
|
|
|
}
|