Skip to content

Commit 3012c15

Browse files
committed
Test config option rule: null -> hardcoded default, false -> disabled
1 parent d6a6d04 commit 3012c15

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/Framework/ConfigTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ public function test_get_and_set()
4848

4949
$this->assertSame(4190, $object->get('test_int'));
5050

51+
// If the configured value is `null`, expect the fallback value (which is `null` by default).
52+
$object->set('test', null);
53+
$this->assertNull($object->get('test'));
54+
$this->assertSame('fallback', $object->get('test', 'fallback'));
55+
56+
// If the configured value is `false`, expect `false`, regardless of the fallback value.
57+
$object->set('test', false);
58+
$this->assertFalse($object->get('test'));
59+
$this->assertFalse($object->get('test', 'wrong'));
60+
5161
// TODO: test more code paths in get() and set()
5262
}
5363

0 commit comments

Comments
 (0)