assertSame(trim($expected), trim($postgresql)); } public function test_it_adds_group_by() { $sql = 'SELECT COUNT(id), username FROM users'; $expected = 'SELECT COUNT(id) AS count0, username FROM users GROUP BY username'; $postgresql = pg4wp_rewrite($sql); $this->assertSame(trim($expected), trim($postgresql)); } public function test_it_handles_auto_increment() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_handles_auto_increment_without_null() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_handles_numerics_without_auto_incrment_case_insensitively() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_handles_keys() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_handles_keys_without_unique() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_does_not_remove_if_not_exists() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_removes_character_sets() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_handles_multiple_keys() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_removes_table_charsets() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_can_create_keys_with_length() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_can_create_double_keys_with_length() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_will_handle_found_rows_on_queries_with_order_by_case() { $GLOBALS['pg4wp_numrows_query'] = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_will_append_returning_id_to_insert_statements() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_can_handle_replacement_sql() { $sql = "REPLACE INTO test2 (column1, column2, column3) VALUES (1, 'Old', '2014-08-20 18:47:00')"; $expected = "INSERT INTO test2 (column1, column2, column3) VALUES (1, 'Old', '2014-08-20 18:47:00') ON CONFLICT (column1) DO UPDATE SET column2 = EXCLUDED.column2, column3 = EXCLUDED.column3 RETURNING *"; $postgresql = pg4wp_rewrite($sql); $this->assertSame(trim($expected), trim($postgresql)); } public function test_it_doesnt_rewrite_when_it_doesnt_need_to() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_handles_alter_tables_with_indexes() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_handles_alter_tables_with_unique_indexes() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_rewrites_protected_column_names() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_rewrites_advanced_protected_column_names() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_doesnt_remove_single_quotes() { $sql = <<assertSame(trim($expected), trim($postgresql)); } public function test_it_can_handle_insert_sql_containing_nested_parathesis_with_numbers() { $sql = <<