Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #80 from tim96/fix-windows-suffix
Browse files Browse the repository at this point in the history
Change suffix in auth parameters to keep windows compatibility.
  • Loading branch information
dizda committed Dec 7, 2015
2 parents d90b45b + 918a256 commit d4eac60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Database/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}
}
Expand Down
18 changes: 6 additions & 12 deletions Tests/Database/MySQLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/**
Expand All @@ -43,7 +43,7 @@ public function shouldDumpSpecifiedDatabase()
'db_password' => 'test',
),
), '/var/backup/');

$mysql2 = new MySQLDummy(array(
'mysql' => array(
'all_databases' => false,
Expand All @@ -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(
Expand Down Expand Up @@ -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");
}

/**
Expand All @@ -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");
}

/**
Expand Down

0 comments on commit d4eac60

Please sign in to comment.