Skip to content

Commit

Permalink
[10.x] Add test for dot method in collections (#46407)
Browse files Browse the repository at this point in the history
  • Loading branch information
sevannerse committed Mar 9, 2023
1 parent 90f24d9 commit 7f57a54
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5531,6 +5531,42 @@ public function testUndot($collection)
], $data->all());
}

/**
* @dataProvider collectionClassProvider
*/
public function testDot($collection)
{
$data = $collection::make([
'name' => 'Taylor',
'meta' => [
'foo' => 'bar',
'baz' => 'boom',
'bam' => [
'boom' => 'bip',
],
],
])->dot();
$this->assertSame([
'name' => 'Taylor',
'meta.foo' => 'bar',
'meta.baz' => 'boom',
'meta.bam.boom' => 'bip',
], $data->all());

$data = $collection::make([
'foo' => [
'bar',
'baz',
'baz' => 'boom',
],
])->dot();
$this->assertSame([
'foo.0' => 'bar',
'foo.1' => 'baz',
'foo.baz' => 'boom',
], $data->all());
}

/**
* Provides each collection class, respectively.
*
Expand Down

0 comments on commit 7f57a54

Please sign in to comment.