Skip to content

Commit f68ee19

Browse files
CloCkWeRXfreekmurze
authored andcommitted
Sketch out a test
1 parent 0136609 commit f68ee19

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/DbDumperFactoryTest.php

+25
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,31 @@
9999
expect(DbDumperFactory::createFromConnection('pgsql'))->toBeInstanceOf(PostgreSql::class);
100100
});
101101

102+
it('ignores malformed ports', function () {
103+
$dbConfig = [
104+
'driver' => 'mysql',
105+
'read' => [
106+
'host' => 'localhost-read',
107+
'database' => 'myDb-read',
108+
'port' => ''
109+
],
110+
'write' => [
111+
'host' => 'localhost-write',
112+
'database' => 'myDb-write',
113+
'port' => 'fish'
114+
],
115+
'username' => 'root',
116+
'password' => 'myPassword',
117+
'dump' => ['add_extra_option' => '--extra-option=value'],
118+
];
119+
120+
config()->set('database.connections.mysql', $dbConfig);
121+
122+
$dumper = DbDumperFactory::createFromConnection('mysql');
123+
124+
expect($dumper->getPort())->toEqual(null);
125+
});
126+
102127
it('will use the read db when one is defined', function () {
103128
$dbConfig = [
104129
'driver' => 'mysql',

0 commit comments

Comments
 (0)