From 373238d0558d8772848b415dbed7293b188b3e0a Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Fri, 21 Sep 2018 12:48:23 -0600 Subject: [PATCH] tests for falsey values --- tests/FlatArrayTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/FlatArrayTest.php b/tests/FlatArrayTest.php index d46565b..b9c457c 100644 --- a/tests/FlatArrayTest.php +++ b/tests/FlatArrayTest.php @@ -89,6 +89,19 @@ class FlatArrayTest extends TestCase ); } + public function testSettingFalseyValues() + { + $a = new FlatArray(['foo'=>['bar'=>'baz']]); + $a['foo.bar'] = false; + $this->assertFalse($a['foo.bar']); + $a['foo.bar'] = 0; + $this->assertEquals(0, $a['foo.bar']); + $a['foo.bar'] = ''; + $this->assertEquals('', $a['foo.bar']); + $a['foo.bar'] = []; + $this->assertEquals([], $a['foo.bar']); + } + public function testCaseSensitivity() { $h = new FlatArray([