From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- tests/simple_unit/DbCommon/PgsqlColumnTest.php | 272 ++++++++++++------------- 1 file changed, 136 insertions(+), 136 deletions(-) (limited to 'tests/simple_unit/DbCommon/PgsqlColumnTest.php') diff --git a/tests/simple_unit/DbCommon/PgsqlColumnTest.php b/tests/simple_unit/DbCommon/PgsqlColumnTest.php index de12083e..a16de964 100644 --- a/tests/simple_unit/DbCommon/PgsqlColumnTest.php +++ b/tests/simple_unit/DbCommon/PgsqlColumnTest.php @@ -1,139 +1,139 @@ create_meta_data()->getTableInfo('public.address'); - $this->assertEqual(count($table->getColumns()), 14); - - $columns['id'] = array( - 'ColumnName' => '"id"', - 'ColumnSize' => null, - 'ColumnIndex' => 0, - 'DbType' => 'integer', - 'AllowNull' => false, - 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, - 'NumericPrecision' => null, - 'NumericScale' => null, - 'IsPrimaryKey' => true, - 'IsForeignKey' => false, - 'SequenceName' => 'public.address_id_seq', - ); - - $columns['username'] = array( - 'ColumnName' => '"username"', - 'ColumnSize' => 128, - 'ColumnIndex' => 1, - 'DbType' => 'character varying', - 'AllowNull' => false, - 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, - 'NumericPrecision' => null, - 'NumericScale' => null, - 'IsPrimaryKey' => false, - 'IsForeignKey' => false, - 'SequenceName' => null, - ); - - $columns['phone'] = array( - 'ColumnName' => '"phone"', - 'ColumnSize' => 40, - 'ColumnIndex' => 2, - 'DbType' => 'character', - 'AllowNull' => false, - 'DefaultValue' => "'hello'::bpchar", - 'NumericPrecision' => null, - 'NumericScale' => null, - 'IsPrimaryKey' => false, - 'IsForeignKey' => false, - 'SequenceName' => null, - ); - - $columns['field1_boolean'] = array( - 'ColumnName' => '"field1_boolean"', - 'ColumnSize' => null, - 'ColumnIndex' => 3, - 'DbType' => 'boolean', - 'AllowNull' => false, - 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, - 'NumericPrecision' => null, - 'NumericScale' => null, - 'IsPrimaryKey' => false, - 'IsForeignKey' => false, - 'SequenceName' => null, - ); - - $columns['field4_integer'] = array( - 'ColumnName' => '"field4_integer"', - 'ColumnSize' => null, - 'ColumnIndex' => 6, - 'DbType' => 'integer', - 'AllowNull' => false, - 'DefaultValue' => "1", - 'NumericPrecision' => null, - 'NumericScale' => null, - 'IsPrimaryKey' => false, - 'IsForeignKey' => true, - 'SequenceName' => null, - ); - - $columns['field7_timestamp'] = array( - 'ColumnName' => '"field7_timestamp"', - 'ColumnSize' => 2, - 'ColumnIndex' => 9, - 'DbType' => 'timestamp without time zone', - 'AllowNull' => false, - 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, - 'NumericPrecision' => 6, - 'NumericScale' => null, - 'IsPrimaryKey' => false, - 'IsForeignKey' => false, - 'SequenceName' => null, - ); - - $columns['field9_numeric'] = array( - 'ColumnName' => '"field9_numeric"', - 'ColumnSize' => 393220, - 'ColumnIndex' => 11, - 'DbType' => 'numeric', - 'AllowNull' => false, - 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, - 'NumericPrecision' => 6, - 'NumericScale' => 4, - 'IsPrimaryKey' => false, - 'IsForeignKey' => false, - 'SequenceName' => null, - ); - $this->assertColumn($columns, $table); - - $this->assertEqual('public', $table->getSchemaName()); - $this->assertEqual('address', $table->getTableName()); - $this->assertEqual(array('id'), $table->getPrimaryKeys()); - } - - function assertColumn($columns, $table) - { - foreach($columns as $id=>$asserts) - { - $column = $table->Columns[$id]; - foreach($asserts as $property=>$assert) - { - $ofAssert= var_export($assert,true); - $value = $column->{$property}; - $ofValue = var_export($value, true); - $this->assertEqual($value, $assert, - "Column [{$id}] {$property} value {$ofValue} did not match {$ofAssert}"); - } - } - } -} + +Prado::using('System.Data.*'); +Prado::using('System.Data.Common.Pgsql.TPgsqlMetaData'); +class PgsqlColumnTest extends UnitTestCase +{ + function create_meta_data() + { + $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test'); + return new TPgsqlMetaData($conn); + } + + function test_text_column_def() + { + $table = $this->create_meta_data()->getTableInfo('public.address'); + $this->assertEqual(count($table->getColumns()), 14); + + $columns['id'] = array( + 'ColumnName' => '"id"', + 'ColumnSize' => null, + 'ColumnIndex' => 0, + 'DbType' => 'integer', + 'AllowNull' => false, + 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, + 'NumericPrecision' => null, + 'NumericScale' => null, + 'IsPrimaryKey' => true, + 'IsForeignKey' => false, + 'SequenceName' => 'public.address_id_seq', + ); + + $columns['username'] = array( + 'ColumnName' => '"username"', + 'ColumnSize' => 128, + 'ColumnIndex' => 1, + 'DbType' => 'character varying', + 'AllowNull' => false, + 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, + 'NumericPrecision' => null, + 'NumericScale' => null, + 'IsPrimaryKey' => false, + 'IsForeignKey' => false, + 'SequenceName' => null, + ); + + $columns['phone'] = array( + 'ColumnName' => '"phone"', + 'ColumnSize' => 40, + 'ColumnIndex' => 2, + 'DbType' => 'character', + 'AllowNull' => false, + 'DefaultValue' => "'hello'::bpchar", + 'NumericPrecision' => null, + 'NumericScale' => null, + 'IsPrimaryKey' => false, + 'IsForeignKey' => false, + 'SequenceName' => null, + ); + + $columns['field1_boolean'] = array( + 'ColumnName' => '"field1_boolean"', + 'ColumnSize' => null, + 'ColumnIndex' => 3, + 'DbType' => 'boolean', + 'AllowNull' => false, + 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, + 'NumericPrecision' => null, + 'NumericScale' => null, + 'IsPrimaryKey' => false, + 'IsForeignKey' => false, + 'SequenceName' => null, + ); + + $columns['field4_integer'] = array( + 'ColumnName' => '"field4_integer"', + 'ColumnSize' => null, + 'ColumnIndex' => 6, + 'DbType' => 'integer', + 'AllowNull' => false, + 'DefaultValue' => "1", + 'NumericPrecision' => null, + 'NumericScale' => null, + 'IsPrimaryKey' => false, + 'IsForeignKey' => true, + 'SequenceName' => null, + ); + + $columns['field7_timestamp'] = array( + 'ColumnName' => '"field7_timestamp"', + 'ColumnSize' => 2, + 'ColumnIndex' => 9, + 'DbType' => 'timestamp without time zone', + 'AllowNull' => false, + 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, + 'NumericPrecision' => 6, + 'NumericScale' => null, + 'IsPrimaryKey' => false, + 'IsForeignKey' => false, + 'SequenceName' => null, + ); + + $columns['field9_numeric'] = array( + 'ColumnName' => '"field9_numeric"', + 'ColumnSize' => 393220, + 'ColumnIndex' => 11, + 'DbType' => 'numeric', + 'AllowNull' => false, + 'DefaultValue' => TDbTableColumn::UNDEFINED_VALUE, + 'NumericPrecision' => 6, + 'NumericScale' => 4, + 'IsPrimaryKey' => false, + 'IsForeignKey' => false, + 'SequenceName' => null, + ); + $this->assertColumn($columns, $table); + + $this->assertEqual('public', $table->getSchemaName()); + $this->assertEqual('address', $table->getTableName()); + $this->assertEqual(array('id'), $table->getPrimaryKeys()); + } + + function assertColumn($columns, $table) + { + foreach($columns as $id=>$asserts) + { + $column = $table->Columns[$id]; + foreach($asserts as $property=>$assert) + { + $ofAssert= var_export($assert,true); + $value = $column->{$property}; + $ofValue = var_export($value, true); + $this->assertEqual($value, $assert, + "Column [{$id}] {$property} value {$ofValue} did not match {$ofAssert}"); + } + } + } +} ?> \ No newline at end of file -- cgit v1.2.3