/** * Ensures that a schema given in the 'name' constructor configuration directive overrides any schema specified * by the 'schema' constructor configuration directive. * * @return void */ public function testTableSchemaConstructorConfigNameOverridesSchema() { $schema = 'public'; $tableName = "{$schema}.zfbugs"; $config = array('db' => $this->_db, 'schema' => 'foo', 'name' => $tableName); $table = new \ZendTest\DB\Table\TestAsset\TableBugs($config); $tableInfo = $table->info(); $this->assertEquals($schema, $tableInfo['schema']); }
public function testTableExceptionInvalidPrimaryKey() { try { $table = new \ZendTest\DB\Table\TestAsset\TableBugs(array('primary' => 'foo')); $primary = $table->info(Table\AbstractTable::PRIMARY); $this->fail('Expected to catch Zend_Db_Table_Exception'); } catch (\Zend\Exception $e) { $this->assertType('Zend\\DB\\Table\\Exception', $e, 'Expecting object of type Zend_Db_Table_Exception, got ' . get_class($e)); $this->assertContains("Primary key column(s)", $e->getMessage()); $this->assertContains("are not columns in this table", $e->getMessage()); } }