Skip to content

Commit 2fa8836

Browse files
MAGETWO-52981: [Github] Setup:upgrade does not work with custom mysql port #4548
1 parent 21c4cc1 commit 2fa8836

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -526,28 +526,27 @@ public function getIndexNameDataProvider()
526526
];
527527
}
528528

529-
/**
530-
* @test
531-
*/
532-
public function connectPortThrow()
529+
public function testConfigValidation()
533530
{
534-
$arguments = [
535-
'config' => ['host' => 'localhost'],
536-
];
537-
$subject = (new ObjectManager($this))->getObject(Mysql::class, $arguments);
538-
$this->assertInstanceOf(Mysql::class, $subject);
531+
$subject = (new ObjectManager($this))->getObject(
532+
Mysql::class,
533+
[
534+
'config' => ['host' => 'localhost'],
535+
]
536+
);
539537

540-
$arguments = [
541-
'config' => ['host' => 'localhost', 'port' => '33390'],
542-
];
538+
$this->assertInstanceOf(Mysql::class, $subject);
539+
}
543540

544-
try {
545-
(new ObjectManager($this))->getObject(Mysql::class, $arguments);
546-
$this->fail('an expected exception was not thrown');
547-
} catch (\InvalidArgumentException $e) {
548-
$expected = 'MySQL adapter: Port must be configured within host (like \'localhost:33390\') ' .
549-
'parameter, not within port';
550-
$this->assertSame($expected, $e->getMessage());
551-
}
541+
/**
542+
* @expectedException \InvalidArgumentException
543+
* @expectedExceptionMessage Port must be configured within host (like 'localhost:33390') parameter, not within port
544+
*/
545+
public function testConfigValidationByPortWithException()
546+
{
547+
(new ObjectManager($this))->getObject(
548+
Mysql::class,
549+
['config' => ['host' => 'localhost', 'port' => '33390']]
550+
);
552551
}
553552
}

lib/internal/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/Mysql.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ private function getValidConfig(array $config)
116116

117117
if (isset($config['port'])) {
118118
throw new \InvalidArgumentException(
119-
"MySQL adapter: Port must be configured within host (like '$config[host]:$config[port]') parameter, " .
120-
"not within port"
119+
"Port must be configured within host (like '$config[host]:$config[port]') parameter, not within port"
121120
);
122121
}
123122

0 commit comments

Comments
 (0)