We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7799d12 commit 3363a36Copy full SHA for 3363a36
1 file changed
tests/ExtendedArgumentsFunctionTest.php
@@ -0,0 +1,34 @@
1
+<?php
2
+
3
+namespace Tests\Koded\Stdlib;
4
5
+use Koded\Stdlib\ExtendedArguments;
6
+use PHPUnit\Framework\TestCase;
7
+use function Koded\Stdlib\extended;
8
9
+class ExtendedArgumentsFunctionTest extends TestCase
10
+{
11
+ public function test_extended_arguments_function()
12
+ {
13
+ $actual = [
14
+ 'foo.bar' => [1, 2, 3]
15
+ ];
16
+ $expected = [
17
+ 'foo' => [
18
+ 'bar' => [1, 2, 3]
19
+ ]
20
21
22
+ $data = extended($actual);
23
+ $this->assertInstanceOf(ExtendedArguments::class, $data);
24
+ $this->assertSame($expected, $data->toArray());
25
26
+ $this->assertSame(3, $data->get('foo.bar.2'));
27
+ $this->assertSame(['foo.bar.2' => 3], $data->extract(['foo.bar.2']));
28
29
+ // mutate the value
30
+ $data->foo = 'bar';
31
+ $this->assertSame(['foo' => 'bar'], $data->toArray());
32
+ }
33
34
+}
0 commit comments