From 3dc5dde0713a7672a9c2d41d94b8f891ae98da1c Mon Sep 17 00:00:00 2001 From: frank Date: Tue, 27 Jun 2017 03:09:45 +0300 Subject: [PATCH] Replace doublequotes --- Tests/DriverMysqliTest.php | 2 +- Tests/DriverPgsqlTest.php | 59 ++++++++++++----------- Tests/DriverPostgresqlTest.php | 59 ++++++++++++----------- Tests/ImporterMySqlTest.php | 18 +++---- Tests/ImporterPgsqlTest.php | 16 +++---- Tests/ImporterPostgresqlTest.php | 16 +++---- Tests/QueryElementTest.php | 8 ++-- Tests/QueryMysqlTest.php | 28 +++++------ Tests/QueryMysqliTest.php | 28 +++++------ Tests/QueryPgsqlTest.php | 40 ++++++++-------- Tests/QueryPostgresqlTest.php | 48 +++++++++---------- Tests/QuerySqliteTest.php | 28 +++++------ Tests/QuerySqlsrvTest.php | 28 +++++------ Tests/QueryTest.php | 74 ++++++++++++++--------------- src/DatabaseDriver.php | 2 +- src/Mysql/MysqlDriver.php | 2 +- src/Mysqli/MysqliDriver.php | 2 +- src/Oracle/OracleQuery.php | 6 +-- src/Pdo/PdoDriver.php | 4 +- src/Pgsql/PgsqlDriver.php | 16 +++---- src/Postgresql/PostgresqlDriver.php | 18 +++---- src/Postgresql/PostgresqlQuery.php | 4 +- src/Sqlite/SqliteDriver.php | 2 +- src/Sqlsrv/SqlsrvDriver.php | 6 +-- src/Sqlsrv/SqlsrvQuery.php | 24 +++++----- 25 files changed, 270 insertions(+), 268 deletions(-) diff --git a/Tests/DriverMysqliTest.php b/Tests/DriverMysqliTest.php index 28aa99e5d..539f074d5 100644 --- a/Tests/DriverMysqliTest.php +++ b/Tests/DriverMysqliTest.php @@ -613,7 +613,7 @@ public function testExecutePreparedStatement() /** @var \Joomla\Database\Mysqli\MysqliQuery $query */ $query = self::$driver->getQuery(true); $query->setQuery( - "REPLACE INTO `jos_dbtest` SET `id` = ?, `title` = ?, `start_date` = ?, `description` = ?" + 'REPLACE INTO `jos_dbtest` SET `id` = ?, `title` = ?, `start_date` = ?, `description` = ?' ); $query->bind(1, $id, 'i'); $query->bind(2, $title); diff --git a/Tests/DriverPgsqlTest.php b/Tests/DriverPgsqlTest.php index 71a62c1a9..c2deb6990 100644 --- a/Tests/DriverPgsqlTest.php +++ b/Tests/DriverPgsqlTest.php @@ -402,29 +402,30 @@ public function testGetTableSequences() public function testGetTableList() { $expected = array( - "0" => "jos_assets", - "1" => "jos_categories", - "2" => "jos_content", - "3" => "jos_core_log_searches", - "4" => "jos_dbtest", - "5" => "jos_extensions", - "6" => "jos_languages", - "7" => "jos_log_entries", - "8" => "jos_menu", - "9" => "jos_menu_types", - "10" => "jos_modules", - "11" => "jos_modules_menu", - "12" => "jos_schemas", - "13" => "jos_session", - "14" => "jos_update_categories", - "15" => "jos_update_sites", - "16" => "jos_update_sites_extensions", - "17" => "jos_updates", - "18" => "jos_user_profiles", - "19" => "jos_user_usergroup_map", - "20" => "jos_usergroups", - "21" => "jos_users", - "22" => "jos_viewlevels"); + '0' => 'jos_assets', + '1' => 'jos_categories', + '2' => 'jos_content', + '3' => 'jos_core_log_searches', + '4' => 'jos_dbtest', + '5' => 'jos_extensions', + '6' => 'jos_languages', + '7' => 'jos_log_entries', + '8' => 'jos_menu', + '9' => 'jos_menu_types', + '10' => 'jos_modules', + '11' => 'jos_modules_menu', + '12' => 'jos_schemas', + '13' => 'jos_session', + '14' => 'jos_update_categories', + '15' => 'jos_update_sites', + '16' => 'jos_update_sites_extensions', + '17' => 'jos_updates', + '18' => 'jos_user_profiles', + '19' => 'jos_user_usergroup_map', + '20' => 'jos_usergroups', + '21' => 'jos_users', + '22' => 'jos_viewlevels' + ); $result = self::$driver->getTableList(); @@ -491,9 +492,9 @@ public function testInsertObject() self::$driver->setQuery('TRUNCATE TABLE "jos_dbtest"')->execute(); $tst = new \stdClass; - $tst->title = "PostgreSQL test insertObject"; + $tst->title = 'PostgreSQL test insertObject'; $tst->start_date = '2012-04-07 15:00:00'; - $tst->description = "Test insertObject"; + $tst->description = 'Test insertObject'; // Insert object without retrieving key $ret = self::$driver->insertObject('#__dbtest', $tst); @@ -511,9 +512,9 @@ public function testInsertObject() // Insert object retrieving the key $tstK = new \stdClass; - $tstK->title = "PostgreSQL test insertObject with key"; + $tstK->title = 'PostgreSQL test insertObject with key'; $tstK->start_date = '2012-04-07 15:00:00'; - $tstK->description = "Test insertObject with key"; + $tstK->description = 'Test insertObject with key'; $retK = self::$driver->insertObject('#__dbtest', $tstK, 'id'); $this->assertThat($tstK->id, $this->equalTo(2), __LINE__); @@ -821,10 +822,10 @@ public function testSqlValue() // Object containing fields of integer, character varying, timestamp and text type $tst = new \stdClass; $tst->id = '5'; - $tst->charVar = "PostgreSQL test insertObject"; + $tst->charVar = 'PostgreSQL test insertObject'; $tst->timeStamp = '2012-04-07 15:00:00'; $tst->nullDate = null; - $tst->txt = "Test insertObject"; + $tst->txt = 'Test insertObject'; $tst->boolTrue = true; $tst->boolFalse = false; $tst->num = '43.2'; diff --git a/Tests/DriverPostgresqlTest.php b/Tests/DriverPostgresqlTest.php index 83290035e..9ec3a31bd 100644 --- a/Tests/DriverPostgresqlTest.php +++ b/Tests/DriverPostgresqlTest.php @@ -402,29 +402,30 @@ public function testGetTableSequences() public function testGetTableList() { $expected = array( - "0" => "jos_assets", - "1" => "jos_categories", - "2" => "jos_content", - "3" => "jos_core_log_searches", - "4" => "jos_dbtest", - "5" => "jos_extensions", - "6" => "jos_languages", - "7" => "jos_log_entries", - "8" => "jos_menu", - "9" => "jos_menu_types", - "10" => "jos_modules", - "11" => "jos_modules_menu", - "12" => "jos_schemas", - "13" => "jos_session", - "14" => "jos_update_categories", - "15" => "jos_update_sites", - "16" => "jos_update_sites_extensions", - "17" => "jos_updates", - "18" => "jos_user_profiles", - "19" => "jos_user_usergroup_map", - "20" => "jos_usergroups", - "21" => "jos_users", - "22" => "jos_viewlevels"); + '0' => 'jos_assets', + '1' => 'jos_categories', + '2' => 'jos_content', + '3' => 'jos_core_log_searches', + '4' => 'jos_dbtest', + '5' => 'jos_extensions', + '6' => 'jos_languages', + '7' => 'jos_log_entries', + '8' => 'jos_menu', + '9' => 'jos_menu_types', + '10' => 'jos_modules', + '11' => 'jos_modules_menu', + '12' => 'jos_schemas', + '13' => 'jos_session', + '14' => 'jos_update_categories', + '15' => 'jos_update_sites', + '16' => 'jos_update_sites_extensions', + '17' => 'jos_updates', + '18' => 'jos_user_profiles', + '19' => 'jos_user_usergroup_map', + '20' => 'jos_usergroups', + '21' => 'jos_users', + '22' => 'jos_viewlevels' + ); $result = self::$driver->getTableList(); @@ -521,9 +522,9 @@ public function testInsertObject() self::$driver->setQuery('TRUNCATE TABLE "jos_dbtest"')->execute(); $tst = new \stdClass; - $tst->title = "PostgreSQL test insertObject"; + $tst->title = 'PostgreSQL test insertObject'; $tst->start_date = '2012-04-07 15:00:00'; - $tst->description = "Test insertObject"; + $tst->description = 'Test insertObject'; // Insert object without retrieving key $ret = self::$driver->insertObject('#__dbtest', $tst); @@ -541,9 +542,9 @@ public function testInsertObject() // Insert object retrieving the key $tstK = new \stdClass; - $tstK->title = "PostgreSQL test insertObject with key"; + $tstK->title = 'PostgreSQL test insertObject with key'; $tstK->start_date = '2012-04-07 15:00:00'; - $tstK->description = "Test insertObject with key"; + $tstK->description = 'Test insertObject with key'; $retK = self::$driver->insertObject('#__dbtest', $tstK, 'id'); $this->assertThat($tstK->id, $this->equalTo(2), __LINE__); @@ -851,10 +852,10 @@ public function testSqlValue() // Object containing fields of integer, character varying, timestamp and text type $tst = new \stdClass; $tst->id = '5'; - $tst->charVar = "PostgreSQL test insertObject"; + $tst->charVar = 'PostgreSQL test insertObject'; $tst->timeStamp = '2012-04-07 15:00:00'; $tst->nullDate = null; - $tst->txt = "Test insertObject"; + $tst->txt = 'Test insertObject'; $tst->boolTrue = 't'; $tst->boolFalse = 'f'; $tst->num = '43.2'; diff --git a/Tests/ImporterMySqlTest.php b/Tests/ImporterMySqlTest.php index 538cecce8..713934f6d 100644 --- a/Tests/ImporterMySqlTest.php +++ b/Tests/ImporterMySqlTest.php @@ -269,21 +269,21 @@ public function dataGetAlterTableSql() array( new \SimpleXmlElement('' . $f1 . $f2 . $k1 . $k2 . ''), array( - "ALTER TABLE `jos_test` ADD UNIQUE KEY `idx_title` (`title`)", + 'ALTER TABLE `jos_test` ADD UNIQUE KEY `idx_title` (`title`)', ), 'getAlterTableSQL should add the new key.' ), array( new \SimpleXmlElement('' . $f1 . $k1 . ''), array( - "ALTER TABLE `jos_test` DROP COLUMN `title`", + 'ALTER TABLE `jos_test` DROP COLUMN `title`', ), 'getAlterTableSQL should remove the title column.' ), array( new \SimpleXmlElement('' . $f1 . $f2 . ''), array( - "ALTER TABLE `jos_test` DROP PRIMARY KEY", + 'ALTER TABLE `jos_test` DROP PRIMARY KEY', ), 'getAlterTableSQL should drop the old primary key.' ), @@ -318,7 +318,7 @@ public function dataGetColumnSql() new \SimpleXmlElement( $this->sample['xml-body-field'] ), - "`body` mediumtext NOT NULL", + '`body` mediumtext NOT NULL', 'Typical blob field', ), ); @@ -341,7 +341,7 @@ public function dataGetKeySql() $this->sample['xml-primary-key'] ), ), - "primary key (`id`)", + 'primary key (`id`)', 'Typical primary key index', ), ); @@ -540,7 +540,7 @@ public function testGetAddKeySql() ) ), $this->equalTo( - "ALTER TABLE `jos_test` ADD PRIMARY KEY (`id`)" + 'ALTER TABLE `jos_test` ADD PRIMARY KEY (`id`)' ), 'testGetAddKeySQL did not yield the expected result.' ); @@ -642,7 +642,7 @@ public function testGetDropColumnSql() 'title' ), $this->equalTo( - "ALTER TABLE `jos_test` DROP COLUMN `title`" + 'ALTER TABLE `jos_test` DROP COLUMN `title`' ), 'getDropColumnSQL did not yield the expected result.' ); @@ -666,7 +666,7 @@ public function testGetDropKeySql() 'idx_title' ), $this->equalTo( - "ALTER TABLE `jos_test` DROP KEY `idx_title`" + 'ALTER TABLE `jos_test` DROP KEY `idx_title`' ), 'getDropKeySQL did not yield the expected result.' ); @@ -689,7 +689,7 @@ public function testGetDropPrimaryKeySql() 'jos_test' ), $this->equalTo( - "ALTER TABLE `jos_test` DROP PRIMARY KEY" + 'ALTER TABLE `jos_test` DROP PRIMARY KEY' ), 'getDropPrimaryKeySQL did not yield the expected result.' ); diff --git a/Tests/ImporterPgsqlTest.php b/Tests/ImporterPgsqlTest.php index 8032338ef..3b0a0a02b 100644 --- a/Tests/ImporterPgsqlTest.php +++ b/Tests/ImporterPgsqlTest.php @@ -288,10 +288,10 @@ public function dataGetAlterTableSql() $addSequence = 'CREATE SEQUENCE jos_dbtest_title_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 ' . 'NO CYCLE OWNED BY "public.jos_dbtest.title"'; - $changeCol = "ALTER TABLE \"jos_test\" ALTER COLUMN \"title\" TYPE character " . + $changeCol = 'ALTER TABLE "jos_test" ALTER COLUMN "title" TYPE character ' . "varying(50),\nALTER COLUMN \"title\" SET NOT NULL,\nALTER COLUMN \"title\" SET DEFAULT 'add default'"; - $changeSeq = "CREATE SEQUENCE jos_dbtest_title_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 " . - "START 1 NO CYCLE OWNED BY \"public.jos_dbtest.title\""; + $changeSeq = 'CREATE SEQUENCE jos_dbtest_title_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 ' . + 'START 1 NO CYCLE OWNED BY "public.jos_dbtest.title"'; return array( array( @@ -350,7 +350,7 @@ public function dataGetAlterTableSql() // Drop idx new \SimpleXmlElement('' . $s1 . $f1 . $f2 . $k1 . ''), array( - "DROP INDEX \"jos_dbtest_idx_name\"" + 'DROP INDEX "jos_dbtest_idx_name"' ), 'getAlterTableSQL should change sequence.' ), @@ -381,14 +381,14 @@ public function dataGetAlterTableSql() new \SimpleXmlElement('' . $s2 . $f1 . $f2 . $k1 . $k2 . ''), array( $changeSeq, - "DROP SEQUENCE \"jos_dbtest_id_seq\"",), + 'DROP SEQUENCE "jos_dbtest_id_seq"',), 'getAlterTableSQL should change sequence.' ), array( // Change idx new \SimpleXmlElement('' . $s1 . $f1 . $f2 . $k1 . $k3 . ''), array( - "CREATE INDEX jos_dbtest_idx_title ON jos_dbtest USING btree (title)", + 'CREATE INDEX jos_dbtest_idx_title ON jos_dbtest USING btree (title)', 'DROP INDEX "jos_dbtest_idx_name"' ), 'getAlterTableSQL should change index.' @@ -700,7 +700,7 @@ public function testGetAddIndexSql() new \SimpleXmlElement($xmlIndex) ), $this->equalTo( - "CREATE INDEX jos_dbtest_idx_name ON jos_dbtest USING btree (name)" + 'CREATE INDEX jos_dbtest_idx_name ON jos_dbtest USING btree (name)' ), 'testGetAddIndexSQL did not yield the expected result.' ); @@ -710,7 +710,7 @@ public function testGetAddIndexSql() new \SimpleXmlElement($xmlPrimaryKey) ), $this->equalTo( - "ALTER TABLE jos_dbtest ADD PRIMARY KEY (id)" + 'ALTER TABLE jos_dbtest ADD PRIMARY KEY (id)' ), 'testGetAddIndexSQL did not yield the expected result.' ); diff --git a/Tests/ImporterPostgresqlTest.php b/Tests/ImporterPostgresqlTest.php index 4d066ce38..d5b793286 100644 --- a/Tests/ImporterPostgresqlTest.php +++ b/Tests/ImporterPostgresqlTest.php @@ -288,10 +288,10 @@ public function dataGetAlterTableSql() $addSequence = 'CREATE SEQUENCE jos_dbtest_title_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 ' . 'NO CYCLE OWNED BY "public.jos_dbtest.title"'; - $changeCol = "ALTER TABLE \"jos_test\" ALTER COLUMN \"title\" TYPE character " . + $changeCol = 'ALTER TABLE "jos_test" ALTER COLUMN "title" TYPE character ' . "varying(50),\nALTER COLUMN \"title\" SET NOT NULL,\nALTER COLUMN \"title\" SET DEFAULT 'add default'"; - $changeSeq = "CREATE SEQUENCE jos_dbtest_title_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 " . - "START 1 NO CYCLE OWNED BY \"public.jos_dbtest.title\""; + $changeSeq = 'CREATE SEQUENCE jos_dbtest_title_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 ' . + 'START 1 NO CYCLE OWNED BY "public.jos_dbtest.title"'; return array( array( @@ -350,7 +350,7 @@ public function dataGetAlterTableSql() // Drop idx new \SimpleXmlElement('' . $s1 . $f1 . $f2 . $k1 . ''), array( - "DROP INDEX \"jos_dbtest_idx_name\"" + 'DROP INDEX "jos_dbtest_idx_name"' ), 'getAlterTableSQL should change sequence.' ), @@ -381,14 +381,14 @@ public function dataGetAlterTableSql() new \SimpleXmlElement('' . $s2 . $f1 . $f2 . $k1 . $k2 . ''), array( $changeSeq, - "DROP SEQUENCE \"jos_dbtest_id_seq\"",), + 'DROP SEQUENCE "jos_dbtest_id_seq"',), 'getAlterTableSQL should change sequence.' ), array( // Change idx new \SimpleXmlElement('' . $s1 . $f1 . $f2 . $k1 . $k3 . ''), array( - "CREATE INDEX jos_dbtest_idx_title ON jos_dbtest USING btree (title)", + 'CREATE INDEX jos_dbtest_idx_title ON jos_dbtest USING btree (title)', 'DROP INDEX "jos_dbtest_idx_name"' ), 'getAlterTableSQL should change index.' @@ -700,7 +700,7 @@ public function testGetAddIndexSql() new \SimpleXmlElement($xmlIndex) ), $this->equalTo( - "CREATE INDEX jos_dbtest_idx_name ON jos_dbtest USING btree (name)" + 'CREATE INDEX jos_dbtest_idx_name ON jos_dbtest USING btree (name)' ), 'testGetAddIndexSQL did not yield the expected result.' ); @@ -710,7 +710,7 @@ public function testGetAddIndexSql() new \SimpleXmlElement($xmlPrimaryKey) ), $this->equalTo( - "ALTER TABLE jos_dbtest ADD PRIMARY KEY (id)" + 'ALTER TABLE jos_dbtest ADD PRIMARY KEY (id)' ), 'testGetAddIndexSQL did not yield the expected result.' ); diff --git a/Tests/QueryElementTest.php b/Tests/QueryElementTest.php index 2a002e981..579237bd8 100644 --- a/Tests/QueryElementTest.php +++ b/Tests/QueryElementTest.php @@ -131,25 +131,25 @@ public function dataTestToString() 'FROM', 'table1', ',', - PHP_EOL . "FROM table1" + PHP_EOL . 'FROM table1' ), array( 'SELECT', array('column1', 'column2'), ',', - PHP_EOL . "SELECT column1,column2" + PHP_EOL . 'SELECT column1,column2' ), array( '()', array('column1', 'column2'), ',', - PHP_EOL . "(column1,column2)" + PHP_EOL . '(column1,column2)' ), array( 'CONCAT()', array('column1', 'column2'), ',', - PHP_EOL . "CONCAT(column1,column2)" + PHP_EOL . 'CONCAT(column1,column2)' ), ); } diff --git a/Tests/QueryMysqlTest.php b/Tests/QueryMysqlTest.php index 7cd80dcf7..e8b7656e3 100644 --- a/Tests/QueryMysqlTest.php +++ b/Tests/QueryMysqlTest.php @@ -35,7 +35,7 @@ public function dataTestNullDate() return array( // Quoted, expected array(true, "'_0000-00-00 00:00:00_'"), - array(false, "0000-00-00 00:00:00"), + array(false, '0000-00-00 00:00:00'), ); } @@ -149,13 +149,13 @@ public function test__toStringSelect() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "SELECT a.id" . - PHP_EOL . "FROM a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "WHERE b.id = 1" . - PHP_EOL . "GROUP BY a.id" . - PHP_EOL . "HAVING COUNT(a.id) > 3" . - PHP_EOL . "ORDER BY a.id" + PHP_EOL . 'SELECT a.id' . + PHP_EOL . 'FROM a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'WHERE b.id = 1' . + PHP_EOL . 'GROUP BY a.id' . + PHP_EOL . 'HAVING COUNT(a.id) > 3' . + PHP_EOL . 'ORDER BY a.id' ), 'Tests for correct rendering.' ); @@ -180,10 +180,10 @@ public function test__toStringUpdate() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "UPDATE #__foo AS a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "SET a.id = 2" . - PHP_EOL . "WHERE b.id = 1" + PHP_EOL . 'UPDATE #__foo AS a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'SET a.id = 2' . + PHP_EOL . 'WHERE b.id = 1' ), 'Tests for correct rendering.' ); @@ -320,14 +320,14 @@ public function test__toStringInsert_subquery() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)" . PHP_EOL . "(" . PHP_EOL . "SELECT col2" . PHP_EOL . "WHERE a=1)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col)' . PHP_EOL . '(' . PHP_EOL . 'SELECT col2' . PHP_EOL . 'WHERE a=1)') ); $q->clear(); $q->insert('table')->columns('col')->values('3'); $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col) VALUES " . PHP_EOL . "(3)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col) VALUES ' . PHP_EOL . '(3)') ); } diff --git a/Tests/QueryMysqliTest.php b/Tests/QueryMysqliTest.php index e0b41444a..93e345bd2 100644 --- a/Tests/QueryMysqliTest.php +++ b/Tests/QueryMysqliTest.php @@ -35,7 +35,7 @@ public function dataTestNullDate() return array( // Quoted, expected array(true, "'_0000-00-00 00:00:00_'"), - array(false, "0000-00-00 00:00:00"), + array(false, '0000-00-00 00:00:00'), ); } @@ -149,13 +149,13 @@ public function test__toStringSelect() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "SELECT a.id" . - PHP_EOL . "FROM a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "WHERE b.id = 1" . - PHP_EOL . "GROUP BY a.id" . - PHP_EOL . "HAVING COUNT(a.id) > 3" . - PHP_EOL . "ORDER BY a.id" + PHP_EOL . 'SELECT a.id' . + PHP_EOL . 'FROM a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'WHERE b.id = 1' . + PHP_EOL . 'GROUP BY a.id' . + PHP_EOL . 'HAVING COUNT(a.id) > 3' . + PHP_EOL . 'ORDER BY a.id' ), 'Tests for correct rendering.' ); @@ -180,10 +180,10 @@ public function test__toStringUpdate() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "UPDATE #__foo AS a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "SET a.id = 2" . - PHP_EOL . "WHERE b.id = 1" + PHP_EOL . 'UPDATE #__foo AS a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'SET a.id = 2' . + PHP_EOL . 'WHERE b.id = 1' ), 'Tests for correct rendering.' ); @@ -320,14 +320,14 @@ public function test__toStringInsert_subquery() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)" . PHP_EOL . "(" . PHP_EOL . "SELECT col2" . PHP_EOL . "WHERE a=1)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col)' . PHP_EOL . '(' . PHP_EOL . 'SELECT col2' . PHP_EOL . 'WHERE a=1)') ); $q->clear(); $q->insert('table')->columns('col')->values('3'); $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col) VALUES " . PHP_EOL . "(3)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col) VALUES ' . PHP_EOL . '(3)') ); } diff --git a/Tests/QueryPgsqlTest.php b/Tests/QueryPgsqlTest.php index 4ee2b09e7..3a45a612f 100644 --- a/Tests/QueryPgsqlTest.php +++ b/Tests/QueryPgsqlTest.php @@ -35,7 +35,7 @@ public function dataTestNullDate() return array( // Quoted, expected array(true, "'_1970-01-01 00:00:00_'"), - array(false, "1970-01-01 00:00:00"), + array(false, '1970-01-01 00:00:00'), ); } @@ -149,13 +149,13 @@ public function test__toStringSelect() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "SELECT a.id" . - PHP_EOL . "FROM a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "WHERE b.id = 1" . - PHP_EOL . "GROUP BY a.id" . - PHP_EOL . "HAVING COUNT(a.id) > 3" . - PHP_EOL . "ORDER BY a.id" + PHP_EOL . 'SELECT a.id' . + PHP_EOL . 'FROM a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'WHERE b.id = 1' . + PHP_EOL . 'GROUP BY a.id' . + PHP_EOL . 'HAVING COUNT(a.id) > 3' . + PHP_EOL . 'ORDER BY a.id' ), 'Tests for correct rendering.' ); @@ -180,10 +180,10 @@ public function test__toStringUpdate() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "UPDATE #__foo AS a" . - PHP_EOL . "SET a.id = 2" . - PHP_EOL . "FROM b" . - PHP_EOL . "WHERE b.id = 1 AND b.id = a.id" + PHP_EOL . 'UPDATE #__foo AS a' . + PHP_EOL . 'SET a.id = 2' . + PHP_EOL . 'FROM b' . + PHP_EOL . 'WHERE b.id = 1 AND b.id = a.id' ), 'Tests for correct rendering.' ); @@ -204,7 +204,7 @@ public function test__toStringYear() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (YEAR FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (YEAR FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -223,7 +223,7 @@ public function test__toStringMonth() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (MONTH FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (MONTH FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -242,7 +242,7 @@ public function test__toStringDay() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (DAY FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (DAY FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -261,7 +261,7 @@ public function test__toStringHour() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (HOUR FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (HOUR FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -280,7 +280,7 @@ public function test__toStringMinute() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (MINUTE FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (MINUTE FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -299,7 +299,7 @@ public function test__toStringSecond() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (SECOND FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (SECOND FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -320,14 +320,14 @@ public function test__toStringInsert_subquery() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)" . PHP_EOL . "(" . PHP_EOL . "SELECT col2" . PHP_EOL . "WHERE a=1)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col)' . PHP_EOL . '(' . PHP_EOL . 'SELECT col2' . PHP_EOL . 'WHERE a=1)') ); $q->clear(); $q->insert('table')->columns('col')->values('3'); $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col) VALUES " . PHP_EOL . "(3)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col) VALUES ' . PHP_EOL . '(3)') ); } diff --git a/Tests/QueryPostgresqlTest.php b/Tests/QueryPostgresqlTest.php index 3abdf4902..19738f666 100644 --- a/Tests/QueryPostgresqlTest.php +++ b/Tests/QueryPostgresqlTest.php @@ -43,7 +43,7 @@ public function dataTestNullDate() return array( // Quoted, expected array(true, "'_1970-01-01 00:00:00_'"), - array(false, "1970-01-01 00:00:00"), + array(false, '1970-01-01 00:00:00'), ); } @@ -180,13 +180,13 @@ public function test__toStringSelect() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "SELECT a.id" . - PHP_EOL . "FROM a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "WHERE b.id = 1" . - PHP_EOL . "GROUP BY a.id" . - PHP_EOL . "HAVING COUNT(a.id) > 3" . - PHP_EOL . "ORDER BY a.id" + PHP_EOL . 'SELECT a.id' . + PHP_EOL . 'FROM a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'WHERE b.id = 1' . + PHP_EOL . 'GROUP BY a.id' . + PHP_EOL . 'HAVING COUNT(a.id) > 3' . + PHP_EOL . 'ORDER BY a.id' ), 'Tests for correct rendering.' ); @@ -210,10 +210,10 @@ public function test__toStringUpdate() $string = (string) $this->instance; $this->assertEquals( - PHP_EOL . "UPDATE #__foo AS a" . - PHP_EOL . "SET a.hits = 0" . - PHP_EOL . "FROM b" . - PHP_EOL . "WHERE b.id = a.id", + PHP_EOL . 'UPDATE #__foo AS a' . + PHP_EOL . 'SET a.hits = 0' . + PHP_EOL . 'FROM b' . + PHP_EOL . 'WHERE b.id = a.id', $string ); @@ -227,10 +227,10 @@ public function test__toStringUpdate() $string = (string) $this->instance; $this->assertEquals( - PHP_EOL . "UPDATE #__foo AS a" . - PHP_EOL . "SET a.id = 2" . - PHP_EOL . "FROM b" . - PHP_EOL . "WHERE b.id = 1 AND b.id = a.id", + PHP_EOL . 'UPDATE #__foo AS a' . + PHP_EOL . 'SET a.id = 2' . + PHP_EOL . 'FROM b' . + PHP_EOL . 'WHERE b.id = 1 AND b.id = a.id', $string ); @@ -256,7 +256,7 @@ public function test__toStringYear() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (YEAR FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (YEAR FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -275,7 +275,7 @@ public function test__toStringMonth() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (MONTH FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (MONTH FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -294,7 +294,7 @@ public function test__toStringDay() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (DAY FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (DAY FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -313,7 +313,7 @@ public function test__toStringHour() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (HOUR FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (HOUR FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -332,7 +332,7 @@ public function test__toStringMinute() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (MINUTE FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (MINUTE FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -351,7 +351,7 @@ public function test__toStringSecond() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "SELECT EXTRACT (SECOND FROM \"col\")" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT EXTRACT (SECOND FROM "col")' . PHP_EOL . 'FROM table') ); } @@ -372,14 +372,14 @@ public function test__toStringInsert_subquery() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)" . PHP_EOL . "(" . PHP_EOL . "SELECT col2" . PHP_EOL . "WHERE a=1)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col)' . PHP_EOL . '(' . PHP_EOL . 'SELECT col2' . PHP_EOL . 'WHERE a=1)') ); $q->clear(); $q->insert('table')->columns('col')->values('3'); $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col) VALUES " . PHP_EOL . "(3)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col) VALUES ' . PHP_EOL . '(3)') ); } diff --git a/Tests/QuerySqliteTest.php b/Tests/QuerySqliteTest.php index 26b0a28f4..5da7efeae 100644 --- a/Tests/QuerySqliteTest.php +++ b/Tests/QuerySqliteTest.php @@ -35,7 +35,7 @@ public function dataTestNullDate() return array( // Quoted, expected array(true, "'_0000-00-00 00:00:00_'"), - array(false, "0000-00-00 00:00:00"), + array(false, '0000-00-00 00:00:00'), ); } @@ -149,13 +149,13 @@ public function test__toStringSelect() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "SELECT a.id" . - PHP_EOL . "FROM a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "WHERE b.id = 1" . - PHP_EOL . "GROUP BY a.id" . - PHP_EOL . "HAVING COUNT(a.id) > 3" . - PHP_EOL . "ORDER BY a.id" + PHP_EOL . 'SELECT a.id' . + PHP_EOL . 'FROM a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'WHERE b.id = 1' . + PHP_EOL . 'GROUP BY a.id' . + PHP_EOL . 'HAVING COUNT(a.id) > 3' . + PHP_EOL . 'ORDER BY a.id' ), 'Tests for correct rendering.' ); @@ -180,10 +180,10 @@ public function test__toStringUpdate() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "UPDATE #__foo AS a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "SET a.id = 2" . - PHP_EOL . "WHERE b.id = 1" + PHP_EOL . 'UPDATE #__foo AS a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'SET a.id = 2' . + PHP_EOL . 'WHERE b.id = 1' ), 'Tests for correct rendering.' ); @@ -320,14 +320,14 @@ public function test__toStringInsert_subquery() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)" . PHP_EOL . "(" . PHP_EOL . "SELECT col2" . PHP_EOL . "WHERE a=1)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col)' . PHP_EOL . '(' . PHP_EOL . 'SELECT col2' . PHP_EOL . 'WHERE a=1)') ); $q->clear(); $q->insert('table')->columns('col')->values('3'); $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col) VALUES " . PHP_EOL . "(3)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col) VALUES ' . PHP_EOL . '(3)') ); } diff --git a/Tests/QuerySqlsrvTest.php b/Tests/QuerySqlsrvTest.php index d1aa25c0a..7f6904fa7 100644 --- a/Tests/QuerySqlsrvTest.php +++ b/Tests/QuerySqlsrvTest.php @@ -35,7 +35,7 @@ public function dataTestNullDate() return array( // Quoted, expected array(true, "'_0000-00-00 00:00:00_'"), - array(false, "0000-00-00 00:00:00"), + array(false, '0000-00-00 00:00:00'), ); } @@ -151,13 +151,13 @@ public function test__toStringSelect() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "SELECT a.id" . - PHP_EOL . "FROM a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "WHERE b.id = 1" . - PHP_EOL . "GROUP BY a.id" . - PHP_EOL . "HAVING COUNT(a.id) > 3" . - PHP_EOL . "ORDER BY a.id" + PHP_EOL . 'SELECT a.id' . + PHP_EOL . 'FROM a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'WHERE b.id = 1' . + PHP_EOL . 'GROUP BY a.id' . + PHP_EOL . 'HAVING COUNT(a.id) > 3' . + PHP_EOL . 'ORDER BY a.id' ), 'Tests for correct rendering.' ); @@ -182,10 +182,10 @@ public function test__toStringUpdate() $this->assertThat( (string) $q, $this->equalTo( - PHP_EOL . "UPDATE #__foo AS a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "SET a.id = 2" . - PHP_EOL . "WHERE b.id = 1" + PHP_EOL . 'UPDATE #__foo AS a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'SET a.id = 2' . + PHP_EOL . 'WHERE b.id = 1' ), 'Tests for correct rendering.' ); @@ -322,14 +322,14 @@ public function test__toStringInsert_subquery() $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)VALUES " . PHP_EOL . "(" . PHP_EOL . "SELECT col2" . PHP_EOL . "WHERE a=1)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col)VALUES ' . PHP_EOL . '(' . PHP_EOL . 'SELECT col2' . PHP_EOL . 'WHERE a=1)') ); $q->clear(); $q->insert('table')->columns('col')->values('3'); $this->assertThat( (string) $q, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)VALUES " . PHP_EOL . "(3)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col)VALUES ' . PHP_EOL . '(3)') ); } diff --git a/Tests/QueryTest.php b/Tests/QueryTest.php index 45074dc54..aef3b54c0 100644 --- a/Tests/QueryTest.php +++ b/Tests/QueryTest.php @@ -62,7 +62,7 @@ public function seedNullDateTest() return array( // @todo quoted, expected array(true, "'_0000-00-00 00:00:00_'"), - array(false, "0000-00-00 00:00:00"), + array(false, '0000-00-00 00:00:00'), ); } @@ -150,8 +150,8 @@ public function test__toStringFrom_subquery() $this->assertThat( (string) $this->instance, $this->equalTo( - PHP_EOL . "SELECT col" . PHP_EOL . - "FROM ( " . PHP_EOL . "SELECT col2" . PHP_EOL . "FROM table" . PHP_EOL . "WHERE a=1 ) AS `alias`" + PHP_EOL . 'SELECT col' . PHP_EOL . + 'FROM ( ' . PHP_EOL . 'SELECT col2' . PHP_EOL . 'FROM table' . PHP_EOL . 'WHERE a=1 ) AS `alias`' ) ); } @@ -172,14 +172,14 @@ public function test__toStringInsert_subquery() $this->assertThat( (string) $this->instance, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)" . PHP_EOL . "(" . PHP_EOL . "SELECT col2" . PHP_EOL . "WHERE a=1)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col)' . PHP_EOL . '(' . PHP_EOL . 'SELECT col2' . PHP_EOL . 'WHERE a=1)') ); $this->instance->clear(); $this->instance->insert('table')->columns('col')->values('3'); $this->assertThat( (string) $this->instance, - $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col) VALUES " . PHP_EOL . "(3)") + $this->equalTo(PHP_EOL . 'INSERT INTO table' . PHP_EOL . '(col) VALUES ' . PHP_EOL . '(3)') ); } @@ -196,7 +196,7 @@ public function test__toStringYear() $this->assertThat( (string) $this->instance, - $this->equalTo(PHP_EOL . "SELECT YEAR(`col`)" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT YEAR(`col`)' . PHP_EOL . 'FROM table') ); } @@ -213,7 +213,7 @@ public function test__toStringMonth() $this->assertThat( (string) $this->instance, - $this->equalTo(PHP_EOL . "SELECT MONTH(`col`)" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT MONTH(`col`)' . PHP_EOL . 'FROM table') ); } @@ -230,7 +230,7 @@ public function test__toStringDay() $this->assertThat( (string) $this->instance, - $this->equalTo(PHP_EOL . "SELECT DAY(`col`)" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT DAY(`col`)' . PHP_EOL . 'FROM table') ); } @@ -247,7 +247,7 @@ public function test__toStringHour() $this->assertThat( (string) $this->instance, - $this->equalTo(PHP_EOL . "SELECT HOUR(`col`)" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT HOUR(`col`)' . PHP_EOL . 'FROM table') ); } @@ -264,7 +264,7 @@ public function test__toStringMinute() $this->assertThat( (string) $this->instance, - $this->equalTo(PHP_EOL . "SELECT MINUTE(`col`)" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT MINUTE(`col`)' . PHP_EOL . 'FROM table') ); } @@ -281,7 +281,7 @@ public function test__toStringSecond() $this->assertThat( (string) $this->instance, - $this->equalTo(PHP_EOL . "SELECT SECOND(`col`)" . PHP_EOL . "FROM table") + $this->equalTo(PHP_EOL . 'SELECT SECOND(`col`)' . PHP_EOL . 'FROM table') ); } @@ -305,13 +305,13 @@ public function test__toStringSelect() $this->assertThat( (string) $this->instance, $this->equalTo( - PHP_EOL . "SELECT a.id" . - PHP_EOL . "FROM a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "WHERE b.id = 1" . - PHP_EOL . "GROUP BY a.id" . - PHP_EOL . "HAVING COUNT(a.id) > 3" . - PHP_EOL . "ORDER BY a.id" + PHP_EOL . 'SELECT a.id' . + PHP_EOL . 'FROM a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'WHERE b.id = 1' . + PHP_EOL . 'GROUP BY a.id' . + PHP_EOL . 'HAVING COUNT(a.id) > 3' . + PHP_EOL . 'ORDER BY a.id' ), 'Tests for correct rendering.' ); @@ -334,10 +334,10 @@ public function test__toStringUpdate() $this->assertThat( (string) $this->instance, $this->equalTo( - PHP_EOL . "UPDATE #__foo AS a" . - PHP_EOL . "INNER JOIN b ON b.id = a.id" . - PHP_EOL . "SET a.id = 2" . - PHP_EOL . "WHERE b.id = 1" + PHP_EOL . 'UPDATE #__foo AS a' . + PHP_EOL . 'INNER JOIN b ON b.id = a.id' . + PHP_EOL . 'SET a.id = 2' . + PHP_EOL . 'WHERE b.id = 1' ), 'Tests for correct rendering.' ); @@ -357,7 +357,7 @@ public function test__toStringUnion() $this->instance->select('*') ->union('SELECT id FROM a'); - $this->assertEquals("UNION (SELECT id FROM a)", trim($this->instance)); + $this->assertEquals('UNION (SELECT id FROM a)', trim($this->instance)); } /** @@ -788,7 +788,7 @@ public function testDump() $this->instance->dump(), $this->equalTo( '
' .
-					PHP_EOL . "SELECT *" . PHP_EOL . "FROM foo" .
+					PHP_EOL . 'SELECT *' . PHP_EOL . 'FROM foo' .
 					'
' ), 'Tests that the dump method replaces the prefix correctly.' @@ -1259,8 +1259,8 @@ public function testQuoteException() public function testQuoteName() { $this->assertThat( - $this->instance->quoteName("test"), - $this->equalTo("`test`"), + $this->instance->quoteName('test'), + $this->equalTo('`test`'), 'The quoteName method should be a proxy for the JDatabase::escape method.' ); } @@ -1383,7 +1383,7 @@ public function testSet() ); $this->instance->set('bar = 2'); - $this->assertEquals("SET foo = 1" . PHP_EOL . "\t, bar = 2", trim(TestHelper::getValue($this->instance, 'set')), 'Tests appending with set().'); + $this->assertEquals('SET foo = 1' . PHP_EOL . "\t, bar = 2", trim(TestHelper::getValue($this->instance, 'set')), 'Tests appending with set().'); // Clear the set. TestHelper::setValue($this->instance, 'set', null); @@ -1396,7 +1396,7 @@ public function testSet() $this->assertThat( trim(TestHelper::getValue($this->instance, 'set')), - $this->identicalTo("SET foo = 1" . PHP_EOL . "\t, bar = 2"), + $this->identicalTo('SET foo = 1' . PHP_EOL . "\t, bar = 2"), 'Tests set with an array.' ); @@ -1412,7 +1412,7 @@ public function testSet() $this->assertThat( trim(TestHelper::getValue($this->instance, 'set')), - $this->identicalTo("SET foo = 1" . PHP_EOL . "\t; bar = 2"), + $this->identicalTo('SET foo = 1' . PHP_EOL . "\t; bar = 2"), 'Tests set with an array and glue.' ); } @@ -1832,7 +1832,7 @@ public function testUnionUnion() $teststring = (string) TestHelper::getValue($this->instance, 'union'); $this->assertThat( $teststring, - $this->equalTo(PHP_EOL . "UNION (SELECT name FROM foo)"), + $this->equalTo(PHP_EOL . 'UNION (SELECT name FROM foo)'), 'Tests rendered query with union.' ); } @@ -1852,7 +1852,7 @@ public function testUnionDistinctString() $teststring = (string) TestHelper::getValue($this->instance, 'union'); $this->assertThat( $teststring, - $this->equalTo(PHP_EOL . "UNION DISTINCT (SELECT name FROM foo)"), + $this->equalTo(PHP_EOL . 'UNION DISTINCT (SELECT name FROM foo)'), 'Tests rendered query with union distinct as a string.' ); } @@ -1872,7 +1872,7 @@ public function testUnionDistinctTrue() $teststring = (string) TestHelper::getValue($this->instance, 'union'); $this->assertThat( $teststring, - $this->equalTo(PHP_EOL . "UNION DISTINCT (SELECT name FROM foo)"), + $this->equalTo(PHP_EOL . 'UNION DISTINCT (SELECT name FROM foo)'), 'Tests rendered query with union distinct true.' ); } @@ -1892,7 +1892,7 @@ public function testUnionDistinctFalse() $teststring = (string) TestHelper::getValue($this->instance, 'union'); $this->assertThat( $teststring, - $this->equalTo(PHP_EOL . "UNION (SELECT name FROM foo)"), + $this->equalTo(PHP_EOL . 'UNION (SELECT name FROM foo)'), 'Tests rendered query with union distinct false.' ); } @@ -1912,7 +1912,7 @@ public function testUnionArray() $teststring = (string) TestHelper::getValue($this->instance, 'union'); $this->assertThat( $teststring, - $this->equalTo(PHP_EOL . "UNION (SELECT name FROM foo)" . PHP_EOL . "UNION (SELECT name FROM bar)"), + $this->equalTo(PHP_EOL . 'UNION (SELECT name FROM foo)' . PHP_EOL . 'UNION (SELECT name FROM bar)'), 'Tests rendered query with two unions as an array.' ); } @@ -1933,7 +1933,7 @@ public function testUnionTwo() $teststring = (string) TestHelper::getValue($this->instance, 'union'); $this->assertThat( $teststring, - $this->equalTo(PHP_EOL . "UNION (SELECT name FROM foo)" . PHP_EOL . "UNION (SELECT name FROM bar)"), + $this->equalTo(PHP_EOL . 'UNION (SELECT name FROM foo)' . PHP_EOL . 'UNION (SELECT name FROM bar)'), 'Tests rendered query with two unions sequentially.' ); } @@ -1953,7 +1953,7 @@ public function testUnionDistinct() $teststring = (string) TestHelper::getValue($this->instance, 'union'); $this->assertThat( trim($teststring), - $this->equalTo("UNION DISTINCT (SELECT name FROM foo)"), + $this->equalTo('UNION DISTINCT (SELECT name FROM foo)'), 'Tests rendered query with unionDistinct.' ); } @@ -1973,7 +1973,7 @@ public function testUnionDistinctArray() $teststring = (string) TestHelper::getValue($this->instance, 'union'); $this->assertThat( $teststring, - $this->equalTo(PHP_EOL . "UNION DISTINCT (SELECT name FROM foo)" . PHP_EOL . "UNION DISTINCT (SELECT name FROM bar)"), + $this->equalTo(PHP_EOL . 'UNION DISTINCT (SELECT name FROM foo)' . PHP_EOL . 'UNION DISTINCT (SELECT name FROM bar)'), 'Tests rendered query with two unions distinct.' ); } diff --git a/src/DatabaseDriver.php b/src/DatabaseDriver.php index e6f884a38..e24b2ac74 100644 --- a/src/DatabaseDriver.php +++ b/src/DatabaseDriver.php @@ -1875,7 +1875,7 @@ public function updateObject($table, &$object, $key, $nulls = false) } // Set the query and execute the update. - $this->setQuery(sprintf($statement, implode(",", $fields), implode(' AND ', $where))); + $this->setQuery(sprintf($statement, implode(',', $fields), implode(' AND ', $where))); return $this->execute(); } diff --git a/src/Mysql/MysqlDriver.php b/src/Mysql/MysqlDriver.php index c362e4f3f..29e98b652 100644 --- a/src/Mysql/MysqlDriver.php +++ b/src/Mysql/MysqlDriver.php @@ -323,7 +323,7 @@ public function getTableColumns($table, $typeOnly = true) { foreach ($fields as $field) { - $result[$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type); + $result[$field->Field] = preg_replace('/[(0-9)]/', '', $field->Type); } } // If we want the whole field data object add that to the list. diff --git a/src/Mysqli/MysqliDriver.php b/src/Mysqli/MysqliDriver.php index 951c0f08c..b5872f052 100644 --- a/src/Mysqli/MysqliDriver.php +++ b/src/Mysqli/MysqliDriver.php @@ -475,7 +475,7 @@ public function getTableColumns($table, $typeOnly = true) { foreach ($fields as $field) { - $result[$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type); + $result[$field->Field] = preg_replace('/[(0-9)]/', '', $field->Type); } } else diff --git a/src/Oracle/OracleQuery.php b/src/Oracle/OracleQuery.php index b5b7bbbee..f72725367 100644 --- a/src/Oracle/OracleQuery.php +++ b/src/Oracle/OracleQuery.php @@ -159,13 +159,13 @@ public function processLimit($query, $limit, $offset = 0) // Check if we need to mangle the query. if ($limit || $offset) { - $query = "SELECT joomla2.* + $query = 'SELECT joomla2.* FROM ( SELECT joomla1.*, ROWNUM AS joomla_db_rownum FROM ( - " . $query . " + ' . $query . ' ) joomla1 - ) joomla2"; + ) joomla2'; // Check if the limit value is greater than zero. if ($limit > 0) diff --git a/src/Pdo/PdoDriver.php b/src/Pdo/PdoDriver.php index a28b9e2a4..07a008617 100644 --- a/src/Pdo/PdoDriver.php +++ b/src/Pdo/PdoDriver.php @@ -419,7 +419,7 @@ public function execute() { // Get the error number and message before we execute any more queries. $errorNum = (int) $this->connection->errorCode(); - $errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo()); + $errorMsg = (string) 'SQL: ' . implode(', ', $this->connection->errorInfo()); // Check if the server was disconnected. if (!$this->connected()) @@ -435,7 +435,7 @@ public function execute() { // Get the error number and message. $this->errorNum = (int) $this->connection->errorCode(); - $this->errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo()); + $this->errorMsg = (string) 'SQL: ' . implode(', ', $this->connection->errorInfo()); $this->log( Log\LogLevel::ERROR, diff --git a/src/Pgsql/PgsqlDriver.php b/src/Pgsql/PgsqlDriver.php index 8b0809789..4ea47ed3e 100644 --- a/src/Pgsql/PgsqlDriver.php +++ b/src/Pgsql/PgsqlDriver.php @@ -220,21 +220,21 @@ public function getTableColumns($table, $typeOnly = true) { foreach ($fields as $field) { - $result[$field->column_name] = preg_replace("/[(0-9)]/", '', $field->type); + $result[$field->column_name] = preg_replace('/[(0-9)]/', '', $field->type); } } else { foreach ($fields as $field) { - if (stristr(strtolower($field->type), "character varying")) + if (stristr(strtolower($field->type), 'character varying')) { - $field->Default = ""; + $field->Default = ''; } - if (stristr(strtolower($field->type), "text")) + if (stristr(strtolower($field->type), 'text')) { - $field->Default = ""; + $field->Default = ''; } // Do some dirty translation to MySQL output. @@ -257,7 +257,7 @@ public function getTableColumns($table, $typeOnly = true) // Change Postgresql's NULL::* type with PHP's null one foreach ($fields as $field) { - if (preg_match("/^NULL::*/", $field->Default)) + if (preg_match('/^NULL::*/', $field->Default)) { $field->Default = null; } @@ -651,7 +651,7 @@ public function insertObject($table, &$object, $key = null) } // Ignore any internal fields or primary keys with value 0. - if (($k[0] == "_") || ($k == $key && (($v === 0) || ($v === '0')))) + if (($k[0] == '_') || ($k == $key && (($v === 0) || ($v === '0')))) { continue; } @@ -974,7 +974,7 @@ public function updateObject($table, &$object, $key, $nulls = false) } // Set the query and execute the update. - $this->setQuery(sprintf($statement, implode(",", $fields), implode(' AND ', $where))); + $this->setQuery(sprintf($statement, implode(',', $fields), implode(' AND ', $where))); return $this->execute(); } diff --git a/src/Postgresql/PostgresqlDriver.php b/src/Postgresql/PostgresqlDriver.php index 9dea0bfb4..6d03a1ad2 100644 --- a/src/Postgresql/PostgresqlDriver.php +++ b/src/Postgresql/PostgresqlDriver.php @@ -465,21 +465,21 @@ public function getTableColumns($table, $typeOnly = true) { foreach ($fields as $field) { - $result[$field->column_name] = preg_replace("/[(0-9)]/", '', $field->type); + $result[$field->column_name] = preg_replace('/[(0-9)]/', '', $field->type); } } else { foreach ($fields as $field) { - if (stristr(strtolower($field->type), "character varying")) + if (stristr(strtolower($field->type), 'character varying')) { - $field->Default = ""; + $field->Default = ''; } - if (stristr(strtolower($field->type), "text")) + if (stristr(strtolower($field->type), 'text')) { - $field->Default = ""; + $field->Default = ''; } // Do some dirty translation to MySQL output. @@ -502,7 +502,7 @@ public function getTableColumns($table, $typeOnly = true) /* Change Postgresql's NULL::* type with PHP's null one */ foreach ($fields as $field) { - if (preg_match("/^NULL::*/", $field->Default)) + if (preg_match('/^NULL::*/', $field->Default)) { $field->Default = null; } @@ -680,7 +680,7 @@ public function insertid() $colNameQuery->select('column_default') ->from('information_schema.columns') ->where( - "table_name=" . $this->quote( + 'table_name=' . $this->quote( $this->replacePrefix(str_replace('"', '', $table[0])) ), 'AND' ) @@ -1229,7 +1229,7 @@ public function insertObject($table, &$object, $key = null) } // Ignore any internal fields or primary keys with value 0. - if (($k[0] == "_") || ($k == $key && (($v === 0) || ($v === '0')))) + if (($k[0] == '_') || ($k == $key && (($v === 0) || ($v === '0')))) { continue; } @@ -1601,7 +1601,7 @@ public function updateObject($table, &$object, $key, $nulls = false) } // Set the query and execute the update. - $this->setQuery(sprintf($statement, implode(",", $fields), implode(' AND ', $where))); + $this->setQuery(sprintf($statement, implode(',', $fields), implode(' AND ', $where))); return $this->execute(); } diff --git a/src/Postgresql/PostgresqlQuery.php b/src/Postgresql/PostgresqlQuery.php index a18af63c5..e78f5a33e 100644 --- a/src/Postgresql/PostgresqlQuery.php +++ b/src/Postgresql/PostgresqlQuery.php @@ -717,11 +717,11 @@ public function dateAdd($date, $interval, $datePart) { if (substr($interval, 0, 1) != '-') { - return "timestamp '" . $date . "' + interval '" . $interval . " " . $datePart . "'"; + return "timestamp '" . $date . "' + interval '" . $interval . ' ' . $datePart . "'"; } else { - return "timestamp '" . $date . "' - interval '" . ltrim($interval, '-') . " " . $datePart . "'"; + return "timestamp '" . $date . "' - interval '" . ltrim($interval, '-') . ' ' . $datePart . "'"; } } diff --git a/src/Sqlite/SqliteDriver.php b/src/Sqlite/SqliteDriver.php index 02ce07c8e..461ac23d3 100644 --- a/src/Sqlite/SqliteDriver.php +++ b/src/Sqlite/SqliteDriver.php @@ -292,7 +292,7 @@ public function getVersion() { $this->connect(); - $this->setQuery("SELECT sqlite_version()"); + $this->setQuery('SELECT sqlite_version()'); return $this->loadResult(); } diff --git a/src/Sqlsrv/SqlsrvDriver.php b/src/Sqlsrv/SqlsrvDriver.php index 289e06ac2..9478b3c0a 100644 --- a/src/Sqlsrv/SqlsrvDriver.php +++ b/src/Sqlsrv/SqlsrvDriver.php @@ -403,7 +403,7 @@ public function getTableColumns($table, $typeOnly = true) { foreach ($fields as $field) { - $result[$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type); + $result[$field->Field] = preg_replace('/[(0-9)]/', '', $field->Type); } } else @@ -1045,8 +1045,8 @@ protected function checkFieldExists($table, $field) $this->connect(); $table = $this->replacePrefix((string) $table); - $sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS" . " WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" . - " ORDER BY ORDINAL_POSITION"; + $sql = 'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS' . " WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" . + ' ORDER BY ORDINAL_POSITION'; $this->setQuery($sql); if ($this->loadResult()) diff --git a/src/Sqlsrv/SqlsrvQuery.php b/src/Sqlsrv/SqlsrvQuery.php index 7dd609781..acb463a93 100644 --- a/src/Sqlsrv/SqlsrvQuery.php +++ b/src/Sqlsrv/SqlsrvQuery.php @@ -294,10 +294,10 @@ public function group($columns) } // Transform $columns into an array for filtering purposes - is_string($columns) && $columns = explode(',', str_replace(" ", "", $columns)); + is_string($columns) && $columns = explode(',', str_replace(' ', '', $columns)); // Get the _formatted_ FROM string and remove everything except `table AS alias` - $fromStr = str_replace(array("[","]"), "", str_replace("#__", $this->db->getPrefix(), str_replace("FROM ", "", (string) $this->from))); + $fromStr = str_replace(array('[', ']'), '', str_replace('#__', $this->db->getPrefix(), str_replace('FROM ', '', (string) $this->from))); // Start setting up an array of alias => table list($table, $alias) = preg_split("/\sAS\s/i", $fromStr); @@ -307,14 +307,14 @@ public function group($columns) foreach ($tmpCols as $name => $type) { - $cols[] = $alias . "." . $name; + $cols[] = $alias . '.' . $name; } // Now we need to get all tables from any joins // Go through all joins and add them to the tables array foreach ($this->join as $join) { - $joinTbl = str_replace("#__", $this->db->getPrefix(), str_replace("]", "", preg_replace("/.*(#.+\sAS\s[^\s]*).*/i", "$1", (string) $join))); + $joinTbl = str_replace('#__', $this->db->getPrefix(), str_replace(']', '', preg_replace("/.*(#.+\sAS\s[^\s]*).*/i", '$1', (string) $join))); list($table, $alias) = preg_split("/\sAS\s/i", $joinTbl); @@ -322,26 +322,26 @@ public function group($columns) foreach ($tmpCols as $name => $tmpColType) { - $cols[] = $alias . "." . $name; + $cols[] = $alias . '.' . $name; } } - $selectStr = str_replace("SELECT ", "", (string) $this->select); + $selectStr = str_replace('SELECT ', '', (string) $this->select); // Remove any functions (e.g. COUNT(), SUM(), CONCAT()) - $selectCols = preg_replace("/([^,]*\([^\)]*\)[^,]*,?)/", "", $selectStr); + $selectCols = preg_replace("/([^,]*\([^\)]*\)[^,]*,?)/", '', $selectStr); // Remove any "as alias" statements - $selectCols = preg_replace("/(\sas\s[^,]*)/i", "", $selectCols); + $selectCols = preg_replace("/(\sas\s[^,]*)/i", '', $selectCols); // Remove any extra commas - $selectCols = preg_replace("/,{2,}/", ",", $selectCols); + $selectCols = preg_replace('/,{2,}/', ',', $selectCols); // Remove any trailing commas and all whitespaces - $selectCols = trim(str_replace(" ", "", preg_replace("/,?$/", "", $selectCols))); + $selectCols = trim(str_replace(' ', '', preg_replace('/,?$/', '', $selectCols))); // Get an array to compare against - $selectCols = explode(",", $selectCols); + $selectCols = explode(',', $selectCols); // Find all alias.* and fill with proper table column names foreach ($selectCols as $key => $aliasColName) @@ -349,7 +349,7 @@ public function group($columns) if (preg_match("/.+\*/", $aliasColName, $match)) { // Grab the table alias minus the .* - $aliasStar = preg_replace("/(.+)\.\*/", "$1", $aliasColName); + $aliasStar = preg_replace("/(.+)\.\*/", '$1', $aliasColName); // Unset the array key unset($selectCols[$key]);