diff options
-rw-r--r-- | lib/mysql.php | 10 | ||||
-rw-r--r-- | tests/MySqlShimTest.php | 19 |
2 files changed, 16 insertions, 13 deletions
diff --git a/lib/mysql.php b/lib/mysql.php index cd45f46..d2d9772 100644 --- a/lib/mysql.php +++ b/lib/mysql.php @@ -153,9 +153,9 @@ namespace { $link = \Dshafik\MySQL::getConnection($link); return mysqli_query( - $link, - 'USE `' . mysqli_real_escape_string($link, $databaseName) . '`' - ) !== false; + $link, + 'USE `' . mysqli_real_escape_string($link, $databaseName) . '`' + ) !== false; } function mysql_query($query, \mysqli $link = null) @@ -268,10 +268,10 @@ namespace { $found = true; if (strpos($field, '.') !== false) { - list($table, $name) = explode('.', $field); + list($table, $name) = explode('.', $field); $i = 0; $found = false; - mysqli_field_seek($result, 0); + mysqli_field_seek($result, 0); while ($column = mysqli_fetch_field($result)) { if ($column->table === $table && $column->name === $name) { $field = $i; diff --git a/tests/MySqlShimTest.php b/tests/MySqlShimTest.php index 9952e81..58d33b2 100644 --- a/tests/MySqlShimTest.php +++ b/tests/MySqlShimTest.php @@ -14,24 +14,24 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase /** * @var string MySQL Host */ - static protected $host; + protected static $host; - static protected $password = null; + protected static $password = null; /** * @var string Docker container */ - static protected $container; + protected static $container; /** * @var array Location of binaries */ - static protected $bin = array(); + protected static $bin = array(); /** * @var array List of databases created */ - static protected $dbs = array(); + protected static $dbs = array(); /** * @var \SebastianBergmann\Environment\Runtime @@ -308,7 +308,8 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase "INSERT INTO testing (id, one, two, three, four, five, six, seven, eight, nine, ten, eleven) VALUES - (5, '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5')"); + (5, '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5')" + ); $this->assertTrue($result); $this->assertEquals(5, mysql_insert_id()); } @@ -785,7 +786,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase $result = mysql_query('SELECT one, two AS aliased FROM testing'); $this->assertResult($result); - for($i = 0, $max = mysql_num_rows($result); $i < $max; $i++) { + for ($i = 0, $max = mysql_num_rows($result); $i < $max; $i++) { $this->assertEquals($i+1, mysql_result($result, $i, 0)); $this->assertEquals($i+1, mysql_result($result, $i, 'one')); $this->assertEquals($i+1, mysql_result($result, $i, 1)); @@ -889,7 +890,9 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase $this->assertRegExp( '@You have an error in your SQL syntax; check the manual that corresponds to your (.*?) ' . - 'server version for the right syntax to use near \'\' at line 1@', mysql_error()); + 'server version for the right syntax to use near \'\' at line 1@', + mysql_error() + ); } public function test_mysql_errno() |