Skip to content

Commit

Permalink
test(data-get): add tests for null key given
Browse files Browse the repository at this point in the history
  • Loading branch information
jwjenkin committed Jan 2, 2025
1 parent 16c01c2 commit 2da43a3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/Support/SupportHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down

0 comments on commit 2da43a3

Please sign in to comment.