diff --git a/tests/Support/SupportHelpersTest.php b/tests/Support/SupportHelpersTest.php index ee4c09a73101..38ed83afdf96 100644 --- a/tests/Support/SupportHelpersTest.php +++ b/tests/Support/SupportHelpersTest.php @@ -411,6 +411,18 @@ public function testDataGetEscapedSegmentKeys() $this->assertEquals('caret', data_get($array, 'symbols.{last}.description')); } + public function testDataGetNullKey() + { + $data = ['foo' => 'bar']; + + $this->assertEquals([ 'foo' => 'bar' ], data_get($data, null)); + $this->assertEquals([ 'foo' => 'bar' ], data_get($data, null, '42')); + $this->assertEquals([ 'foo' => 'bar' ], data_get($data, [null])); + + $data = ['foo' => 'bar', 'baz' => 42]; + $this->assertEquals([ 'foo' => 'bar', 'baz' => 42 ], data_get($data, [null, 'foo'])); + } + public function testDataFill() { $data = ['foo' => 'bar'];