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 --- .../DbCommon/CommandBuilderPgsqlTest.php | 148 ++++++++++----------- 1 file changed, 74 insertions(+), 74 deletions(-) (limited to 'tests/simple_unit/DbCommon/CommandBuilderPgsqlTest.php') diff --git a/tests/simple_unit/DbCommon/CommandBuilderPgsqlTest.php b/tests/simple_unit/DbCommon/CommandBuilderPgsqlTest.php index 9ee9c411..63660aee 100644 --- a/tests/simple_unit/DbCommon/CommandBuilderPgsqlTest.php +++ b/tests/simple_unit/DbCommon/CommandBuilderPgsqlTest.php @@ -1,76 +1,76 @@ -pgsql_meta_data()->createCommandBuilder('address'); - $address=array( - 'username' => 'Username', - 'phone' => 121987, - 'field1_boolean' => true, - 'field2_date' => '1213', - 'field3_double' => 121.1, - 'field4_integer' => 345, - 'field6_time' => time(), - 'field7_timestamp' => time(), - 'field8_money' => '121.12', - 'field9_numeric' => 984.22, - 'int_fk1'=>1, - 'int_fk2'=>1, - ); - $insert = $builder->createInsertCommand($address); - $sql = 'INSERT INTO public.address("username", "phone", "field1_boolean", "field2_date", "field3_double", "field4_integer", "field6_time", "field7_timestamp", "field8_money", "field9_numeric", "int_fk1", "int_fk2") VALUES (:username, :phone, :field1_boolean, :field2_date, :field3_double, :field4_integer, :field6_time, :field7_timestamp, :field8_money, :field9_numeric, :int_fk1, :int_fk2)'; - $this->assertEqual($sql, $insert->Text); - } - - function test_update_command() - { - $builder = $this->pgsql_meta_data()->createCommandBuilder('address'); - $data = array( - 'phone' => 9809, - 'int_fk1' => 1212, - ); - $update = $builder->createUpdateCommand($data, '1'); - $sql = 'UPDATE public.address SET "phone" = :phone, "int_fk1" = :int_fk1 WHERE 1'; - $this->assertEqual($sql, $update->Text); - } - - function test_delete_command() - { - $builder = $this->pgsql_meta_data()->createCommandBuilder('address'); - $where = 'phone is NULL'; - $delete = $builder->createDeleteCommand($where); - $sql = 'DELETE FROM public.address WHERE phone is NULL'; - $this->assertEqual($sql, $delete->Text); - } - - function test_select_limit() - { - $meta = $this->pgsql_meta_data(); - $builder = $meta->createCommandBuilder('address'); - $query = 'SELECT * FROM '.$meta->getTableInfo('address')->getTableFullName(); - - $limit = $builder->applyLimitOffset($query, 1); - $expect = $query.' LIMIT 1'; - $this->assertEqual($expect, $limit); - - $limit = $builder->applyLimitOffset($query, -1, 10); - $expect = $query.' OFFSET 10'; - $this->assertEqual($expect, $limit); - - $limit = $builder->applyLimitOffset($query, 2, 3); - $expect = $query.' LIMIT 2 OFFSET 3'; - $this->assertEqual($expect, $limit); - } -} +pgsql_meta_data()->createCommandBuilder('address'); + $address=array( + 'username' => 'Username', + 'phone' => 121987, + 'field1_boolean' => true, + 'field2_date' => '1213', + 'field3_double' => 121.1, + 'field4_integer' => 345, + 'field6_time' => time(), + 'field7_timestamp' => time(), + 'field8_money' => '121.12', + 'field9_numeric' => 984.22, + 'int_fk1'=>1, + 'int_fk2'=>1, + ); + $insert = $builder->createInsertCommand($address); + $sql = 'INSERT INTO public.address("username", "phone", "field1_boolean", "field2_date", "field3_double", "field4_integer", "field6_time", "field7_timestamp", "field8_money", "field9_numeric", "int_fk1", "int_fk2") VALUES (:username, :phone, :field1_boolean, :field2_date, :field3_double, :field4_integer, :field6_time, :field7_timestamp, :field8_money, :field9_numeric, :int_fk1, :int_fk2)'; + $this->assertEqual($sql, $insert->Text); + } + + function test_update_command() + { + $builder = $this->pgsql_meta_data()->createCommandBuilder('address'); + $data = array( + 'phone' => 9809, + 'int_fk1' => 1212, + ); + $update = $builder->createUpdateCommand($data, '1'); + $sql = 'UPDATE public.address SET "phone" = :phone, "int_fk1" = :int_fk1 WHERE 1'; + $this->assertEqual($sql, $update->Text); + } + + function test_delete_command() + { + $builder = $this->pgsql_meta_data()->createCommandBuilder('address'); + $where = 'phone is NULL'; + $delete = $builder->createDeleteCommand($where); + $sql = 'DELETE FROM public.address WHERE phone is NULL'; + $this->assertEqual($sql, $delete->Text); + } + + function test_select_limit() + { + $meta = $this->pgsql_meta_data(); + $builder = $meta->createCommandBuilder('address'); + $query = 'SELECT * FROM '.$meta->getTableInfo('address')->getTableFullName(); + + $limit = $builder->applyLimitOffset($query, 1); + $expect = $query.' LIMIT 1'; + $this->assertEqual($expect, $limit); + + $limit = $builder->applyLimitOffset($query, -1, 10); + $expect = $query.' OFFSET 10'; + $this->assertEqual($expect, $limit); + + $limit = $builder->applyLimitOffset($query, 2, 3); + $expect = $query.' LIMIT 2 OFFSET 3'; + $this->assertEqual($expect, $limit); + } +} ?> \ No newline at end of file -- cgit v1.2.3