diff --git a/Database/MySQL.php b/Database/MySQL.php index 5883787..738db71 100644 --- a/Database/MySQL.php +++ b/Database/MySQL.php @@ -58,7 +58,7 @@ public function __construct($params, $basePath) $this->auth = sprintf('-u%s', $params['db_user']); if ($params['db_password']) { - $this->auth = sprintf("--host='%s' --port='%d' --user='%s' --password='%s'", $params['db_host'], $params['db_port'], $params['db_user'], $params['db_password']); + $this->auth = sprintf("--host=\"%s\" --port=\"%d\" --user=\"%s\" --password=\"%s\"", $params['db_host'], $params['db_port'], $params['db_user'], $params['db_password']); } } } diff --git a/Tests/Database/MySQLTest.php b/Tests/Database/MySQLTest.php index 1535421..0c0e7ab 100644 --- a/Tests/Database/MySQLTest.php +++ b/Tests/Database/MySQLTest.php @@ -25,7 +25,7 @@ public function shouldDumpAllDatabases() ), ), '/var/backup/'); - $this->assertEquals($mysql->getCommand(), "mysqldump --host='localhost' --port='3306' --user='root' --password='test' --all-databases > /var/backup/mysql/all-databases.sql"); + $this->assertEquals($mysql->getCommand(), "mysqldump --host=\"localhost\" --port=\"3306\" --user=\"root\" --password=\"test\" --all-databases > /var/backup/mysql/all-databases.sql"); } /** @@ -43,7 +43,7 @@ public function shouldDumpSpecifiedDatabase() 'db_password' => 'test', ), ), '/var/backup/'); - + $mysql2 = new MySQLDummy(array( 'mysql' => array( 'all_databases' => false, @@ -55,15 +55,9 @@ public function shouldDumpSpecifiedDatabase() ), ), '/var/backup/'); - $this->assertEquals($mysql1->getCommand(), "mysqldump --host='localhost' --port='3306' --user='root' --password='test' dizbdd > /var/backup/mysql/dizbdd.sql"); - $this->assertEquals($mysql2->getCommand(), "mysqldump --host='somehost' --port='2222' --user='mysql' --password='somepwd' somebdd > /var/backup/mysql/somebdd.sql"); - } + $this->assertEquals($mysql1->getCommand(), "mysqldump --host=\"localhost\" --port=\"3306\" --user=\"root\" --password=\"test\" dizbdd > /var/backup/mysql/dizbdd.sql"); + $this->assertEquals($mysql2->getCommand(), "mysqldump --host=\"somehost\" --port=\"2222\" --user=\"mysql\" --password=\"somepwd\" somebdd > /var/backup/mysql/somebdd.sql"); - /** - * @test - */ - public function shouldDumpSpecifiedDatabaseWithNoAuth() - { // dump specified database with no auth $mysql = new MySQLDummy(array( 'mysql' => array( @@ -116,7 +110,7 @@ public function shouldIgnoreSpecifiedTablesForSpecifiedDatabase() ), ), '/var/backup/'); - $this->assertEquals($mysql->getCommand(), "mysqldump --host='localhost' --port='3306' --user='root' --password='test' dizbdd --ignore-table=dizbdd.table1 --ignore-table=dizbdd.table2 > /var/backup/mysql/dizbdd.sql"); + $this->assertEquals($mysql->getCommand(), "mysqldump --host=\"localhost\" --port=\"3306\" --user=\"root\" --password=\"test\" dizbdd --ignore-table=dizbdd.table1 --ignore-table=dizbdd.table2 > /var/backup/mysql/dizbdd.sql"); } /** @@ -136,7 +130,7 @@ public function shouldIgnoreSpecifiedTablesForAllDatabase() ), ), '/var/backup/'); - $this->assertEquals($mysql->getCommand(), "mysqldump --host='localhost' --port='3306' --user='root' --password='test' --all-databases --ignore-table=db1.table1 --ignore-table=db2.table2 > /var/backup/mysql/all-databases.sql"); + $this->assertEquals($mysql->getCommand(), "mysqldump --host=\"localhost\" --port=\"3306\" --user=\"root\" --password=\"test\" --all-databases --ignore-table=db1.table1 --ignore-table=db2.table2 > /var/backup/mysql/all-databases.sql"); } /**