Skip to content

Commit d71e340

Browse files
vlakofftaylorotwell
authored andcommitted
[5.2] Tests for Arr::get()/has() with exact key containing dot (laravel#15010)
* Tests for Arr::get()/has() with exact key containing dot * Arr::get() doesn't support key as array, obviously
1 parent e3d63e9 commit d71e340

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/Support/SupportArrTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ public function testFlattenWithDepth()
146146

147147
public function testGet()
148148
{
149+
$array = ['products.desk' => ['price' => 100]];
150+
$this->assertEquals(['price' => 100], Arr::get($array, 'products.desk'));
151+
149152
$array = ['products' => ['desk' => ['price' => 100]]];
150153
$value = Arr::get($array, 'products.desk');
151154
$this->assertEquals(['price' => 100], $value);
@@ -210,6 +213,11 @@ public function testGet()
210213

211214
public function testHas()
212215
{
216+
$array = ['products.desk' => ['price' => 100]];
217+
$this->assertTrue(Arr::has($array, 'products.desk'));
218+
$this->assertTrue(Arr::has($array, ['products.desk']));
219+
$this->assertFalse(Arr::has($array, ['products.desk', 'missing']));
220+
213221
$array = ['products' => ['desk' => ['price' => 100]]];
214222
$this->assertTrue(Arr::has($array, 'products.desk'));
215223
$this->assertTrue(Arr::has($array, 'products.desk.price'));

0 commit comments

Comments
 (0)