diff --git a/src/VIPSoft/DoctrineDataFixturesExtension/Service/Backup/MysqlDumpBackup.php b/src/VIPSoft/DoctrineDataFixturesExtension/Service/Backup/MysqlDumpBackup.php index e941d36..262b51e 100644 --- a/src/VIPSoft/DoctrineDataFixturesExtension/Service/Backup/MysqlDumpBackup.php +++ b/src/VIPSoft/DoctrineDataFixturesExtension/Service/Backup/MysqlDumpBackup.php @@ -73,6 +73,10 @@ public function create($database, $file, array $params) $command .= sprintf(" --password=%s", escapeshellarg($params['password'])); } + if (isset($params['port']) && ($params['port'] > 0)) { + $command .= sprintf(" --port=%s", escapeshellarg($params['port'])); + } + $this->runCommand($command); } @@ -95,6 +99,10 @@ public function restore($database, $file, array $params) $command .= sprintf(" --password=%s", escapeshellarg($params['password'])); } + if (isset($params['port']) && ($params['port'] > 0)) { + $command .= sprintf(" --port=%s", escapeshellarg($params['port'])); + } + $this->runCommand($command); } } diff --git a/tests/VIPSoft/DoctrineDataFixturesExtension/Tests/Service/BackupServiceTest.php b/tests/VIPSoft/DoctrineDataFixturesExtension/Tests/Service/BackupServiceTest.php index 0ee6ff3..b05935c 100644 --- a/tests/VIPSoft/DoctrineDataFixturesExtension/Tests/Service/BackupServiceTest.php +++ b/tests/VIPSoft/DoctrineDataFixturesExtension/Tests/Service/BackupServiceTest.php @@ -67,6 +67,7 @@ public function setUp() 'host' => 'localhost', 'user' => 'root', 'pass' => 'root', + 'port' => 3306 ))); $this->sqliteConnection->expects($this->any()) @@ -84,6 +85,7 @@ public function testRestoreBackup() 'host' => 'localhost', 'user' => 'root', 'pass' => 'root', + 'port' => 3306 ))); $this->sqliteBackup->expects($this->once()) @@ -104,6 +106,7 @@ public function testCreateBackup() 'host' => 'localhost', 'user' => 'root', 'pass' => 'root', + 'port' => 3306 ))); $this->sqliteBackup->expects($this->once())