This repository was archived by the owner on Feb 15, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ function mapPlatformShDatabase() : void
60
60
switch ($ endpoint ['scheme ' ]) {
61
61
case 'mysql ' :
62
62
// Defaults to the latest MariaDB version
63
- $ dbUrl .= '?serverVersion=10.2&charset=utf8mb4 ' ;
63
+ $ dbUrl .= '?charset=utf8mb4& serverVersion=10.2 ' ;
64
64
break ;
65
65
66
66
case 'pgsql ' :
Original file line number Diff line number Diff line change @@ -18,13 +18,15 @@ public function setUp()
18
18
19
19
$ this ->relationships = [
20
20
'database ' => [
21
- 'scheme ' => 'mysql ' ,
22
- 'username ' => 'user ' ,
23
- 'password ' => '' ,
24
- 'host ' => 'database.internal ' ,
25
- 'port ' => '3306 ' ,
26
- 'path ' => 'main ' ,
27
- 'query ' => ['is_master ' => true ],
21
+ [
22
+ 'scheme ' => 'mysql ' ,
23
+ 'username ' => 'user ' ,
24
+ 'password ' => '' ,
25
+ 'host ' => 'database.internal ' ,
26
+ 'port ' => '3306 ' ,
27
+ 'path ' => 'main ' ,
28
+ 'query ' => ['is_master ' => true ],
29
+ ]
28
30
]
29
31
];
30
32
@@ -67,11 +69,21 @@ public function testNoDatabaseRelationship()
67
69
$ rels = $ this ->relationships ;
68
70
unset($ rels ['database ' ]);
69
71
70
- putenv (sprintf ('PLATFORM_RELATIONSHIPS=%s ' , base64_encode (json_encode ($ this -> relationships ))));
72
+ putenv (sprintf ('PLATFORM_RELATIONSHIPS=%s ' , base64_encode (json_encode ($ rels ))));
71
73
72
74
mapPlatformShEnvironment ();
73
75
74
76
$ this ->assertEquals ($ this ->defaultDbUrl , $ _SERVER ['DATABASE_URL ' ]);
75
77
}
76
78
79
+ public function testDatabaseRelationshipSet ()
80
+ {
81
+ putenv ('PLATFORM_APPLICATION=test ' );
82
+ putenv (sprintf ('PLATFORM_RELATIONSHIPS=%s ' , base64_encode (json_encode ($ this ->relationships ))));
83
+
84
+ mapPlatformShEnvironment ();
85
+
86
+ $ this ->assertEquals ('mysql://user:@database.internal:3306/main?charset=utf8mb4&serverVersion=10.2 ' , $ _SERVER ['DATABASE_URL ' ]);
87
+ }
88
+
77
89
}
You can’t perform that action at this time.
0 commit comments