Skip to content

Commit 5b31537

Browse files
committed
updating tests with vars starting with # & checking if space and # is empty
1 parent 22587b7 commit 5b31537

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/Dotenv/DotenvTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function testCommentedDotenvLoadsEnvironmentVars()
5252
$this->assertSame('a value with a # character', getenv('CQUOTES'));
5353
$this->assertSame('a value with a # character & a quote " character inside quotes', getenv('CQUOTESWITHQUOTE'));
5454
$this->assertEmpty(getenv('CNULL'));
55+
$this->assertEmpty(getenv('EMPTY'));
5556
}
5657

5758
public function testQuotedDotenvLoadsEnvironmentVars()
@@ -261,23 +262,27 @@ public function testDotenvAssertions()
261262
$this->assertEmpty(getenv('ASSERTVAR2'));
262263
$this->assertEmpty(getenv('ASSERTVAR3'));
263264
$this->assertSame('0', getenv('ASSERTVAR4'));
265+
$this->assertSame('#foo', getenv('ASSERTVAR5'));
264266

265267
$dotenv->required(array(
266268
'ASSERTVAR1',
267269
'ASSERTVAR2',
268270
'ASSERTVAR3',
269271
'ASSERTVAR4',
272+
'ASSERTVAR5',
270273
));
271274

272275
$dotenv->required(array(
273276
'ASSERTVAR1',
274277
'ASSERTVAR4',
278+
'ASSERTVAR5',
275279
))->notEmpty();
276280

277281
$dotenv->required(array(
278282
'ASSERTVAR1',
279283
'ASSERTVAR4',
280-
))->notEmpty()->allowedValues(array('0', 'val1'));
284+
'ASSERTVAR5',
285+
))->notEmpty()->allowedValues(array('0', 'val1', '#foo'));
281286

282287
$this->assertTrue(true); // anything wrong an an exception will be thrown
283288
}

tests/fixtures/env/assertions.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ ASSERTVAR1="val1"
22
ASSERTVAR2=""
33
ASSERTVAR3=" "
44
ASSERTVAR4="0" # empty looking value
5+
ASSERTVAR5=#foo

0 commit comments

Comments
 (0)