diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 01b49c93afd3..a5e1863c0dda 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -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. *