@@ -138,32 +138,6 @@ public function testDotenvLoadsServerGlobals()
138
138
$ this ->assertEmpty ($ _ENV ['NULL ' ]);
139
139
}
140
140
141
- /**
142
- * @depends testDotenvLoadsEnvironmentVars
143
- * @depends testDotenvLoadsEnvGlobals
144
- * @depends testDotenvLoadsServerGlobals
145
- */
146
- public function testDotenvRequiredStringEnvironmentVars ()
147
- {
148
- $ dotenv = Dotenv::create ($ this ->fixturesFolder );
149
- $ dotenv ->load ();
150
- $ dotenv ->required ('FOO ' );
151
- $ this ->assertTrue (true ); // anything wrong an exception will be thrown
152
- }
153
-
154
- /**
155
- * @depends testDotenvLoadsEnvironmentVars
156
- * @depends testDotenvLoadsEnvGlobals
157
- * @depends testDotenvLoadsServerGlobals
158
- */
159
- public function testDotenvRequiredArrayEnvironmentVars ()
160
- {
161
- $ dotenv = Dotenv::create ($ this ->fixturesFolder );
162
- $ dotenv ->load ();
163
- $ dotenv ->required (['FOO ' , 'BAR ' ]);
164
- $ this ->assertTrue (true ); // anything wrong an exception will be thrown
165
- }
166
-
167
141
public function testDotenvNestedEnvironmentVars ()
168
142
{
169
143
$ dotenv = Dotenv::create ($ this ->fixturesFolder , 'nested.env ' );
@@ -178,47 +152,6 @@ public function testDotenvNestedEnvironmentVars()
178
152
$ this ->assertSame ('${NVAR888} ' , $ _ENV ['NVAR10 ' ]); // nested variable is not set
179
153
}
180
154
181
- /**
182
- * @depends testDotenvLoadsEnvironmentVars
183
- * @depends testDotenvLoadsEnvGlobals
184
- * @depends testDotenvLoadsServerGlobals
185
- */
186
- public function testDotenvAllowedValues ()
187
- {
188
- $ dotenv = Dotenv::create ($ this ->fixturesFolder );
189
- $ dotenv ->load ();
190
- $ dotenv ->required ('FOO ' )->allowedValues (['bar ' , 'baz ' ]);
191
- $ this ->assertTrue (true ); // anything wrong an exception will be thrown
192
- }
193
-
194
- /**
195
- * @depends testDotenvLoadsEnvironmentVars
196
- * @depends testDotenvLoadsEnvGlobals
197
- * @depends testDotenvLoadsServerGlobals
198
- *
199
- * @expectedException \Dotenv\Exception\ValidationException
200
- * @expectedExceptionMessage One or more environment variables failed assertions: FOO is not one of [buzz, buz].
201
- */
202
- public function testDotenvProhibitedValues ()
203
- {
204
- $ dotenv = Dotenv::create ($ this ->fixturesFolder );
205
- $ dotenv ->load ();
206
- $ dotenv ->required ('FOO ' )->allowedValues (['buzz ' , 'buz ' ]);
207
- }
208
-
209
- /**
210
- * @expectedException \Dotenv\Exception\ValidationException
211
- * @expectedExceptionMessage One or more environment variables failed assertions: FOOX is missing, NOPE is missing.
212
- */
213
- public function testDotenvRequiredThrowsRuntimeException ()
214
- {
215
- $ dotenv = Dotenv::create ($ this ->fixturesFolder );
216
- $ dotenv ->load ();
217
- $ this ->assertFalse (getenv ('FOOX ' ));
218
- $ this ->assertFalse (getenv ('NOPE ' ));
219
- $ dotenv ->required (['FOOX ' , 'NOPE ' ]);
220
- }
221
-
222
155
public function testDotenvNullFileArgumentUsesDefault ()
223
156
{
224
157
$ dotenv = Dotenv::create ($ this ->fixturesFolder , null );
@@ -300,92 +233,6 @@ public function testMutlilineLoading()
300
233
$ this ->assertSame ('https://vision.googleapis.com/v1/images:annotate?key= ' , getenv ('TEST_EQS ' ));
301
234
}
302
235
303
- public function testDotenvAssertions ()
304
- {
305
- $ dotenv = Dotenv::create ($ this ->fixturesFolder , 'assertions.env ' );
306
- $ dotenv ->load ();
307
- $ this ->assertSame ('val1 ' , getenv ('ASSERTVAR1 ' ));
308
- $ this ->assertEmpty (getenv ('ASSERTVAR2 ' ));
309
- $ this ->assertSame ('val3 ' , getenv ('ASSERTVAR3 ' ));
310
- $ this ->assertSame ('0 ' , getenv ('ASSERTVAR4 ' ));
311
- $ this ->assertSame ('#foo ' , getenv ('ASSERTVAR5 ' ));
312
- $ this ->assertSame ("val1 \nval2 " , getenv ('ASSERTVAR6 ' ));
313
- $ this ->assertSame ("\nval3 " , getenv ('ASSERTVAR7 ' ));
314
- $ this ->assertSame ("val3 \n" , getenv ('ASSERTVAR8 ' ));
315
-
316
- $ dotenv ->required ([
317
- 'ASSERTVAR1 ' ,
318
- 'ASSERTVAR2 ' ,
319
- 'ASSERTVAR3 ' ,
320
- 'ASSERTVAR4 ' ,
321
- 'ASSERTVAR5 ' ,
322
- 'ASSERTVAR6 ' ,
323
- 'ASSERTVAR7 ' ,
324
- 'ASSERTVAR8 ' ,
325
- 'ASSERTVAR9 ' ,
326
- ]);
327
-
328
- $ dotenv ->required ([
329
- 'ASSERTVAR1 ' ,
330
- 'ASSERTVAR3 ' ,
331
- 'ASSERTVAR4 ' ,
332
- 'ASSERTVAR5 ' ,
333
- 'ASSERTVAR6 ' ,
334
- 'ASSERTVAR7 ' ,
335
- 'ASSERTVAR8 ' ,
336
- ])->notEmpty ();
337
-
338
- $ dotenv ->required ([
339
- 'ASSERTVAR1 ' ,
340
- 'ASSERTVAR4 ' ,
341
- 'ASSERTVAR5 ' ,
342
- ])->notEmpty ()->allowedValues (['0 ' , 'val1 ' , '#foo ' ]);
343
-
344
- $ this ->assertTrue (true ); // anything wrong an an exception will be thrown
345
- }
346
-
347
- /**
348
- * @expectedException \Dotenv\Exception\ValidationException
349
- * @expectedExceptionMessage One or more environment variables failed assertions: ASSERTVAR2 is empty.
350
- */
351
- public function testDotenvEmptyThrowsRuntimeException ()
352
- {
353
- $ dotenv = Dotenv::create ($ this ->fixturesFolder , 'assertions.env ' );
354
- $ dotenv ->load ();
355
- $ this ->assertEmpty (getenv ('ASSERTVAR2 ' ));
356
-
357
- $ dotenv ->required ('ASSERTVAR2 ' )->notEmpty ();
358
- }
359
-
360
- /**
361
- * @expectedException \Dotenv\Exception\ValidationException
362
- * @expectedExceptionMessage One or more environment variables failed assertions: ASSERTVAR9 is empty.
363
- */
364
- public function testDotenvStringOfSpacesConsideredEmpty ()
365
- {
366
- $ dotenv = Dotenv::create ($ this ->fixturesFolder , 'assertions.env ' );
367
- $ dotenv ->load ();
368
- $ dotenv ->required ('ASSERTVAR9 ' )->notEmpty ();
369
- }
370
-
371
- /**
372
- * @expectedException \Dotenv\Exception\ValidationException
373
- * @expectedExceptionMessage One or more environment variables failed assertions: foo is missing.
374
- */
375
- public function testDotenvValidateRequiredWithoutLoading ()
376
- {
377
- $ dotenv = Dotenv::create ($ this ->fixturesFolder , 'assertions.env ' );
378
- $ dotenv ->required ('foo ' );
379
- }
380
-
381
- public function testDotenvRequiredCanBeUsedWithoutLoadingFile ()
382
- {
383
- putenv ('REQUIRED_VAR=1 ' );
384
- $ dotenv = Dotenv::create ($ this ->fixturesFolder );
385
- $ dotenv ->required ('REQUIRED_VAR ' )->notEmpty ();
386
- $ this ->assertTrue (true );
387
- }
388
-
389
236
public function testGetEnvironmentVariablesList ()
390
237
{
391
238
$ dotenv = Dotenv::create ($ this ->fixturesFolder );
0 commit comments