*/
public function testNativeDecimalInsertManualVsAutomatic()
{
- $table = $this->_conn->createTable('users');
- $table->column('company_id', 'integer', array('limit' => 11));
- $table->column('name', 'string', array('limit' => 255, 'default' => ''));
- $table->column('first_name', 'string', array('limit' => 40, 'default' => ''));
- $table->column('approved', 'boolean', array('default' => true));
- $table->column('type', 'string', array('limit' => 255, 'default' => ''));
- $table->column('created_at', 'datetime', array('default' => '0000-00-00 00:00:00'));
- $table->column('created_on', 'date', array('default' => '0000-00-00'));
- $table->column('updated_at', 'datetime', array('default' => '0000-00-00 00:00:00'));
- $table->column('updated_on', 'date', array('default' => '0000-00-00'));
- $table->end();
+ $this->_createTestUsersTable();
$correctValue = 12345678901234567890.0123456789;
// If these asserts fail, that means the INSERT (create function, or cast to SQL) is broken!
$this->assertEquals($correctValue, $user->wealth);
-
- $this->_conn->dropTable('users');
}
public function testNativeTypes()
{
- $table = $this->_conn->createTable('users');
- $table->column('company_id', 'integer', array('limit' => 11));
- $table->column('name', 'string', array('limit' => 255, 'default' => ''));
- $table->column('first_name', 'string', array('limit' => 40, 'default' => ''));
- $table->column('approved', 'boolean', array('default' => true));
- $table->column('type', 'string', array('limit' => 255, 'default' => ''));
- $table->column('created_at', 'datetime', array('default' => '0000-00-00 00:00:00'));
- $table->column('created_on', 'date', array('default' => '0000-00-00'));
- $table->column('updated_at', 'datetime', array('default' => '0000-00-00 00:00:00'));
- $table->column('updated_on', 'date', array('default' => '0000-00-00'));
- $table->end();
+ $this->_createTestUsersTable();
$this->_conn->addColumn("users", "last_name", 'string');
$this->_conn->addColumn("users", "bio", 'text');
public function testUnabstractedDatabaseDependentTypes()
{
+ $this->_createTestUsersTable();
$this->_conn->delete('DELETE FROM users');
$this->_conn->addColumn('users', 'intelligence_quotient', 'tinyint');
} catch (Exception $e) {}
}
+ protected function _createTestUsersTable()
+ {
+ $table = $this->_conn->createTable('users');
+ $table->column('company_id', 'integer', array('limit' => 11));
+ $table->column('name', 'string', array('limit' => 255, 'default' => ''));
+ $table->column('first_name', 'string', array('limit' => 40, 'default' => ''));
+ $table->column('approved', 'boolean', array('default' => true));
+ $table->column('type', 'string', array('limit' => 255, 'default' => ''));
+ $table->column('created_at', 'datetime', array('default' => '0000-00-00 00:00:00'));
+ $table->column('created_on', 'date', array('default' => '0000-00-00'));
+ $table->column('updated_at', 'datetime', array('default' => '0000-00-00 00:00:00'));
+ $table->column('updated_on', 'date', array('default' => '0000-00-00'));
+ $table->end();
+ }
+
/**
* drop test tables
*/
$this->_conn->dropTable('unit_tests');
} catch (Exception $e) {}
try {
+ $this->_conn->dropTable('users');
+ } catch (Exception $e) {}
+ try {
$this->_conn->dropTable('sports');
} catch (Exception $e) {}
try {