@@ -53,39 +53,39 @@ public function testDotenvThrowsExceptionWhenNoFiles()
53
53
public function testDotenvTriesPathsToLoad ()
54
54
{
55
55
$ dotenv = Dotenv::createImmutable ([__DIR__ , $ this ->folder ]);
56
- $ this -> assertCount (4 , $ dotenv ->load ());
56
+ self :: assertCount (4 , $ dotenv ->load ());
57
57
}
58
58
59
59
public function testDotenvTriesPathsToSafeLoad ()
60
60
{
61
61
$ dotenv = Dotenv::createImmutable ([__DIR__ , $ this ->folder ]);
62
- $ this -> assertCount (4 , $ dotenv ->safeLoad ());
62
+ self :: assertCount (4 , $ dotenv ->safeLoad ());
63
63
}
64
64
65
65
public function testDotenvSkipsLoadingIfFileIsMissing ()
66
66
{
67
67
$ dotenv = Dotenv::createImmutable (__DIR__ );
68
- $ this -> assertSame ([], $ dotenv ->safeLoad ());
68
+ self :: assertSame ([], $ dotenv ->safeLoad ());
69
69
}
70
70
71
71
public function testDotenvLoadsEnvironmentVars ()
72
72
{
73
73
$ dotenv = Dotenv::createImmutable ($ this ->folder );
74
- $ this -> assertSame (
74
+ self :: assertSame (
75
75
['FOO ' => 'bar ' , 'BAR ' => 'baz ' , 'SPACED ' => 'with spaces ' , 'NULL ' => '' ],
76
76
$ dotenv ->load ()
77
77
);
78
- $ this -> assertSame ('bar ' , getenv ('FOO ' ));
79
- $ this -> assertSame ('baz ' , getenv ('BAR ' ));
80
- $ this -> assertSame ('with spaces ' , getenv ('SPACED ' ));
81
- $ this -> assertEmpty (getenv ('NULL ' ));
78
+ self :: assertSame ('bar ' , getenv ('FOO ' ));
79
+ self :: assertSame ('baz ' , getenv ('BAR ' ));
80
+ self :: assertSame ('with spaces ' , getenv ('SPACED ' ));
81
+ self :: assertEmpty (getenv ('NULL ' ));
82
82
}
83
83
84
84
public function testDotenvLoadsEnvironmentVarsMultipleNotShortCircuitMode ()
85
85
{
86
86
$ dotenv = Dotenv::createImmutable ($ this ->folder , ['.env ' , 'example.env ' ]);
87
87
88
- $ this -> assertSame (
88
+ self :: assertSame (
89
89
['FOO ' => 'bar ' , 'BAR ' => 'baz ' , 'SPACED ' => 'with spaces ' , 'NULL ' => '' ],
90
90
$ dotenv ->load ()
91
91
);
@@ -95,7 +95,7 @@ public function testDotenvLoadsEnvironmentVarsMultipleWithShortCircuitMode()
95
95
{
96
96
$ dotenv = Dotenv::createImmutable ($ this ->folder , ['.env ' , 'example.env ' ], false );
97
97
98
- $ this -> assertSame (
98
+ self :: assertSame (
99
99
['FOO ' => 'bar ' , 'BAR ' => 'baz ' , 'SPACED ' => 'with spaces ' , 'NULL ' => '' , 'EG ' => 'example ' ],
100
100
$ dotenv ->load ()
101
101
);
@@ -105,102 +105,102 @@ public function testCommentedDotenvLoadsEnvironmentVars()
105
105
{
106
106
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'commented.env ' );
107
107
$ dotenv ->load ();
108
- $ this -> assertSame ('bar ' , getenv ('CFOO ' ));
109
- $ this -> assertFalse (getenv ('CBAR ' ));
110
- $ this -> assertFalse (getenv ('CZOO ' ));
111
- $ this -> assertSame ('with spaces ' , getenv ('CSPACED ' ));
112
- $ this -> assertSame ('a value with a # character ' , getenv ('CQUOTES ' ));
113
- $ this -> assertSame ('a value with a # character & a quote " character inside quotes ' , getenv ('CQUOTESWITHQUOTE ' ));
114
- $ this -> assertEmpty (getenv ('CNULL ' ));
115
- $ this -> assertEmpty (getenv ('EMPTY ' ));
116
- $ this -> assertEmpty (getenv ('EMPTY2 ' ));
117
- $ this -> assertSame ('foo ' , getenv ('FOOO ' ));
108
+ self :: assertSame ('bar ' , getenv ('CFOO ' ));
109
+ self :: assertFalse (getenv ('CBAR ' ));
110
+ self :: assertFalse (getenv ('CZOO ' ));
111
+ self :: assertSame ('with spaces ' , getenv ('CSPACED ' ));
112
+ self :: assertSame ('a value with a # character ' , getenv ('CQUOTES ' ));
113
+ self :: assertSame ('a value with a # character & a quote " character inside quotes ' , getenv ('CQUOTESWITHQUOTE ' ));
114
+ self :: assertEmpty (getenv ('CNULL ' ));
115
+ self :: assertEmpty (getenv ('EMPTY ' ));
116
+ self :: assertEmpty (getenv ('EMPTY2 ' ));
117
+ self :: assertSame ('foo ' , getenv ('FOOO ' ));
118
118
}
119
119
120
120
public function testQuotedDotenvLoadsEnvironmentVars ()
121
121
{
122
122
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'quoted.env ' );
123
123
$ dotenv ->load ();
124
- $ this -> assertSame ('bar ' , getenv ('QFOO ' ));
125
- $ this -> assertSame ('baz ' , getenv ('QBAR ' ));
126
- $ this -> assertSame ('with spaces ' , getenv ('QSPACED ' ));
127
- $ this -> assertEmpty (getenv ('QNULL ' ));
128
-
129
- $ this -> assertSame ('pgsql:host=localhost;dbname=test ' , getenv ('QEQUALS ' ));
130
- $ this -> assertSame ('test some escaped characters like a quote (") or maybe a backslash ( \\) ' , getenv ('QESCAPED ' ));
131
- $ this -> assertSame ('iiiiviiiixiiiiviiii \\n ' , getenv ('QSLASH ' ));
132
- $ this -> assertSame ('iiiiviiiixiiiiviiii \\\\n ' , getenv ('SQSLASH ' ));
124
+ self :: assertSame ('bar ' , getenv ('QFOO ' ));
125
+ self :: assertSame ('baz ' , getenv ('QBAR ' ));
126
+ self :: assertSame ('with spaces ' , getenv ('QSPACED ' ));
127
+ self :: assertEmpty (getenv ('QNULL ' ));
128
+
129
+ self :: assertSame ('pgsql:host=localhost;dbname=test ' , getenv ('QEQUALS ' ));
130
+ self :: assertSame ('test some escaped characters like a quote (") or maybe a backslash ( \\) ' , getenv ('QESCAPED ' ));
131
+ self :: assertSame ('iiiiviiiixiiiiviiii \\n ' , getenv ('QSLASH ' ));
132
+ self :: assertSame ('iiiiviiiixiiiiviiii \\\\n ' , getenv ('SQSLASH ' ));
133
133
}
134
134
135
135
public function testLargeDotenvLoadsEnvironmentVars ()
136
136
{
137
137
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'large.env ' );
138
138
$ dotenv ->load ();
139
- $ this -> assertNotEmpty (getenv ('LARGE ' ));
139
+ self :: assertNotEmpty (getenv ('LARGE ' ));
140
140
}
141
141
142
142
public function testMultipleDotenvLoadsEnvironmentVars ()
143
143
{
144
144
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'multiple.env ' );
145
145
$ dotenv ->load ();
146
- $ this -> assertSame ('bar ' , getenv ('MULTI1 ' ));
147
- $ this -> assertSame ('foo ' , getenv ('MULTI2 ' ));
146
+ self :: assertSame ('bar ' , getenv ('MULTI1 ' ));
147
+ self :: assertSame ('foo ' , getenv ('MULTI2 ' ));
148
148
}
149
149
150
150
public function testExportedDotenvLoadsEnvironmentVars ()
151
151
{
152
152
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'exported.env ' );
153
153
$ dotenv ->load ();
154
- $ this -> assertSame ('bar ' , getenv ('EFOO ' ));
155
- $ this -> assertSame ('baz ' , getenv ('EBAR ' ));
156
- $ this -> assertSame ('with spaces ' , getenv ('ESPACED ' ));
157
- $ this -> assertEmpty (getenv ('ENULL ' ));
154
+ self :: assertSame ('bar ' , getenv ('EFOO ' ));
155
+ self :: assertSame ('baz ' , getenv ('EBAR ' ));
156
+ self :: assertSame ('with spaces ' , getenv ('ESPACED ' ));
157
+ self :: assertEmpty (getenv ('ENULL ' ));
158
158
}
159
159
160
160
public function testDotenvLoadsEnvGlobals ()
161
161
{
162
162
$ dotenv = Dotenv::createImmutable ($ this ->folder );
163
163
$ dotenv ->load ();
164
- $ this -> assertSame ('bar ' , $ _SERVER ['FOO ' ]);
165
- $ this -> assertSame ('baz ' , $ _SERVER ['BAR ' ]);
166
- $ this -> assertSame ('with spaces ' , $ _SERVER ['SPACED ' ]);
167
- $ this -> assertEmpty ($ _SERVER ['NULL ' ]);
164
+ self :: assertSame ('bar ' , $ _SERVER ['FOO ' ]);
165
+ self :: assertSame ('baz ' , $ _SERVER ['BAR ' ]);
166
+ self :: assertSame ('with spaces ' , $ _SERVER ['SPACED ' ]);
167
+ self :: assertEmpty ($ _SERVER ['NULL ' ]);
168
168
}
169
169
170
170
public function testDotenvLoadsServerGlobals ()
171
171
{
172
172
$ dotenv = Dotenv::createImmutable ($ this ->folder );
173
173
$ dotenv ->load ();
174
- $ this -> assertSame ('bar ' , $ _ENV ['FOO ' ]);
175
- $ this -> assertSame ('baz ' , $ _ENV ['BAR ' ]);
176
- $ this -> assertSame ('with spaces ' , $ _ENV ['SPACED ' ]);
177
- $ this -> assertEmpty ($ _ENV ['NULL ' ]);
174
+ self :: assertSame ('bar ' , $ _ENV ['FOO ' ]);
175
+ self :: assertSame ('baz ' , $ _ENV ['BAR ' ]);
176
+ self :: assertSame ('with spaces ' , $ _ENV ['SPACED ' ]);
177
+ self :: assertEmpty ($ _ENV ['NULL ' ]);
178
178
}
179
179
180
180
public function testDotenvNestedEnvironmentVars ()
181
181
{
182
182
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'nested.env ' );
183
183
$ dotenv ->load ();
184
- $ this -> assertSame ('{$NVAR1} {$NVAR2} ' , $ _ENV ['NVAR3 ' ]); // not resolved
185
- $ this -> assertSame ('Hello World! ' , $ _ENV ['NVAR4 ' ]);
186
- $ this -> assertSame ('$NVAR1 {NVAR2} ' , $ _ENV ['NVAR5 ' ]); // not resolved
187
- $ this -> assertSame ('Special Value ' , $ _ENV ['N.VAR6 ' ]); // new '.' (dot) in var name
188
- $ this -> assertSame ('Special Value ' , $ _ENV ['NVAR7 ' ]); // nested '.' (dot) variable
189
- $ this -> assertSame ('' , $ _ENV ['NVAR8 ' ]); // nested variable is empty string
190
- $ this -> assertSame ('' , $ _ENV ['NVAR9 ' ]); // nested variable is empty string
191
- $ this -> assertSame ('${NVAR888} ' , $ _ENV ['NVAR10 ' ]); // nested variable is not set
192
- $ this -> assertSame ('NVAR1 ' , $ _ENV ['NVAR11 ' ]);
193
- $ this -> assertSame ('Hello ' , $ _ENV ['NVAR12 ' ]);
194
- $ this -> assertSame ('${${NVAR11}} ' , $ _ENV ['NVAR13 ' ]); // single quotes
195
- $ this -> assertSame ('${NVAR1} ${NVAR2} ' , $ _ENV ['NVAR14 ' ]); // single quotes
196
- $ this -> assertSame ('${NVAR1} ${NVAR2} ' , $ _ENV ['NVAR15 ' ]); // escaped
184
+ self :: assertSame ('{$NVAR1} {$NVAR2} ' , $ _ENV ['NVAR3 ' ]); // not resolved
185
+ self :: assertSame ('Hello World! ' , $ _ENV ['NVAR4 ' ]);
186
+ self :: assertSame ('$NVAR1 {NVAR2} ' , $ _ENV ['NVAR5 ' ]); // not resolved
187
+ self :: assertSame ('Special Value ' , $ _ENV ['N.VAR6 ' ]); // new '.' (dot) in var name
188
+ self :: assertSame ('Special Value ' , $ _ENV ['NVAR7 ' ]); // nested '.' (dot) variable
189
+ self :: assertSame ('' , $ _ENV ['NVAR8 ' ]); // nested variable is empty string
190
+ self :: assertSame ('' , $ _ENV ['NVAR9 ' ]); // nested variable is empty string
191
+ self :: assertSame ('${NVAR888} ' , $ _ENV ['NVAR10 ' ]); // nested variable is not set
192
+ self :: assertSame ('NVAR1 ' , $ _ENV ['NVAR11 ' ]);
193
+ self :: assertSame ('Hello ' , $ _ENV ['NVAR12 ' ]);
194
+ self :: assertSame ('${${NVAR11}} ' , $ _ENV ['NVAR13 ' ]); // single quotes
195
+ self :: assertSame ('${NVAR1} ${NVAR2} ' , $ _ENV ['NVAR14 ' ]); // single quotes
196
+ self :: assertSame ('${NVAR1} ${NVAR2} ' , $ _ENV ['NVAR15 ' ]); // escaped
197
197
}
198
198
199
199
public function testDotenvNullFileArgumentUsesDefault ()
200
200
{
201
201
$ dotenv = Dotenv::createImmutable ($ this ->folder , null );
202
202
$ dotenv ->load ();
203
- $ this -> assertSame ('bar ' , getenv ('FOO ' ));
203
+ self :: assertSame ('bar ' , getenv ('FOO ' ));
204
204
}
205
205
206
206
/**
@@ -212,70 +212,70 @@ public function testDotenvTrimmedKeys()
212
212
{
213
213
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'quoted.env ' );
214
214
$ dotenv ->load ();
215
- $ this -> assertSame ('no space ' , getenv ('QWHITESPACE ' ));
215
+ self :: assertSame ('no space ' , getenv ('QWHITESPACE ' ));
216
216
}
217
217
218
218
public function testDotenvLoadDoesNotOverwriteEnv ()
219
219
{
220
220
putenv ('IMMUTABLE=true ' );
221
221
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'immutable.env ' );
222
222
$ dotenv ->load ();
223
- $ this -> assertSame ('true ' , getenv ('IMMUTABLE ' ));
223
+ self :: assertSame ('true ' , getenv ('IMMUTABLE ' ));
224
224
}
225
225
226
226
public function testDotenvLoadAfterOverload ()
227
227
{
228
228
putenv ('IMMUTABLE=true ' );
229
229
$ dotenv = Dotenv::createMutable ($ this ->folder , 'immutable.env ' );
230
230
$ dotenv ->load ();
231
- $ this -> assertSame ('false ' , getenv ('IMMUTABLE ' ));
231
+ self :: assertSame ('false ' , getenv ('IMMUTABLE ' ));
232
232
}
233
233
234
234
public function testDotenvOverloadAfterLoad ()
235
235
{
236
236
putenv ('IMMUTABLE=true ' );
237
237
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'immutable.env ' );
238
238
$ dotenv ->load ();
239
- $ this -> assertSame ('true ' , getenv ('IMMUTABLE ' ));
239
+ self :: assertSame ('true ' , getenv ('IMMUTABLE ' ));
240
240
}
241
241
242
242
public function testDotenvOverloadDoesOverwriteEnv ()
243
243
{
244
244
$ dotenv = Dotenv::createMutable ($ this ->folder , 'mutable.env ' );
245
245
$ dotenv ->load ();
246
- $ this -> assertSame ('true ' , getenv ('MUTABLE ' ));
246
+ self :: assertSame ('true ' , getenv ('MUTABLE ' ));
247
247
}
248
248
249
249
public function testDotenvAllowsSpecialCharacters ()
250
250
{
251
251
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'specialchars.env ' );
252
252
$ dotenv ->load ();
253
- $ this -> assertSame ('$a6^C7k%zs+e^.jvjXk ' , getenv ('SPVAR1 ' ));
254
- $ this -> assertSame ('?BUty3koaV3%GA*hMAwH}B ' , getenv ('SPVAR2 ' ));
255
- $ this -> assertSame ('jdgEB4{QgEC]HL))&GcXxokB+wqoN+j>xkV7K?m$r ' , getenv ('SPVAR3 ' ));
256
- $ this -> assertSame ('22222:22#2^{ ' , getenv ('SPVAR4 ' ));
257
- $ this -> assertSame ('test some escaped characters like a quote " or maybe a backslash \\' , getenv ('SPVAR5 ' ));
258
- $ this -> assertSame ('secret!@ ' , getenv ('SPVAR6 ' ));
259
- $ this -> assertSame ('secret!@# ' , getenv ('SPVAR7 ' ));
260
- $ this -> assertSame ('secret!@# ' , getenv ('SPVAR8 ' ));
253
+ self :: assertSame ('$a6^C7k%zs+e^.jvjXk ' , getenv ('SPVAR1 ' ));
254
+ self :: assertSame ('?BUty3koaV3%GA*hMAwH}B ' , getenv ('SPVAR2 ' ));
255
+ self :: assertSame ('jdgEB4{QgEC]HL))&GcXxokB+wqoN+j>xkV7K?m$r ' , getenv ('SPVAR3 ' ));
256
+ self :: assertSame ('22222:22#2^{ ' , getenv ('SPVAR4 ' ));
257
+ self :: assertSame ('test some escaped characters like a quote " or maybe a backslash \\' , getenv ('SPVAR5 ' ));
258
+ self :: assertSame ('secret!@ ' , getenv ('SPVAR6 ' ));
259
+ self :: assertSame ('secret!@# ' , getenv ('SPVAR7 ' ));
260
+ self :: assertSame ('secret!@# ' , getenv ('SPVAR8 ' ));
261
261
}
262
262
263
263
public function testMutlilineLoading ()
264
264
{
265
265
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'multiline.env ' );
266
266
$ dotenv ->load ();
267
- $ this -> assertSame ("test \n test \"test \"\n test " , getenv ('TEST ' ));
268
- $ this -> assertSame ("test \ntest " , getenv ('TEST_ND ' ));
269
- $ this -> assertSame ('test \\ntest ' , getenv ('TEST_NS ' ));
267
+ self :: assertSame ("test \n test \"test \"\n test " , getenv ('TEST ' ));
268
+ self :: assertSame ("test \ntest " , getenv ('TEST_ND ' ));
269
+ self :: assertSame ('test \\ntest ' , getenv ('TEST_NS ' ));
270
270
271
- $ this -> assertSame ('https://vision.googleapis.com/v1/images:annotate?key= ' , getenv ('TEST_EQD ' ));
272
- $ this -> assertSame ('https://vision.googleapis.com/v1/images:annotate?key= ' , getenv ('TEST_EQS ' ));
271
+ self :: assertSame ('https://vision.googleapis.com/v1/images:annotate?key= ' , getenv ('TEST_EQD ' ));
272
+ self :: assertSame ('https://vision.googleapis.com/v1/images:annotate?key= ' , getenv ('TEST_EQS ' ));
273
273
}
274
274
275
275
public function testEmptyLoading ()
276
276
{
277
277
$ dotenv = Dotenv::createImmutable ($ this ->folder , 'empty.env ' );
278
- $ this -> assertSame (['EMPTY_VAR ' => null ], $ dotenv ->load ());
278
+ self :: assertSame (['EMPTY_VAR ' => null ], $ dotenv ->load ());
279
279
}
280
280
281
281
public function testLegacyConstructor ()
@@ -285,7 +285,7 @@ public function testLegacyConstructor()
285
285
286
286
$ dotenv = new Dotenv ($ loader , $ repository , [$ this ->folder .DIRECTORY_SEPARATOR .'.env ' ]);
287
287
288
- $ this -> assertSame ([
288
+ self :: assertSame ([
289
289
'FOO ' => 'bar ' ,
290
290
'BAR ' => 'baz ' ,
291
291
'SPACED ' => 'with spaces ' ,
@@ -301,7 +301,7 @@ public function testLatestConstructor()
301
301
302
302
$ dotenv = new Dotenv ($ loader , $ repository , $ store );
303
303
304
- $ this -> assertSame ([
304
+ self :: assertSame ([
305
305
'FOO ' => 'bar ' ,
306
306
'BAR ' => 'baz ' ,
307
307
'SPACED ' => 'with spaces ' ,
0 commit comments