From 06c5e019b790015b21480d38f35318e691b0c2d8 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl <57864086+pabzm@users.noreply.github.com> Date: Tue, 5 Nov 2024 19:20:14 +0100 Subject: [PATCH] Test config option rule: null -> hardcoded default, false -> disabled (#9684) --- tests/Framework/ConfigTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Framework/ConfigTest.php b/tests/Framework/ConfigTest.php index d3da1e8b8fa..9e3e8d9475f 100644 --- a/tests/Framework/ConfigTest.php +++ b/tests/Framework/ConfigTest.php @@ -48,6 +48,16 @@ public function test_get_and_set() $this->assertSame(4190, $object->get('test_int')); + // If the configured value is `null`, expect the fallback value (which is `null` by default). + $object->set('test', null); + $this->assertNull($object->get('test')); + $this->assertSame('fallback', $object->get('test', 'fallback')); + + // If the configured value is `false`, expect `false`, regardless of the fallback value. + $object->set('test', false); + $this->assertFalse($object->get('test')); + $this->assertFalse($object->get('test', 'wrong')); + // TODO: test more code paths in get() and set() }