Skip to content

Commit 43079a5

Browse files
committed
array_merge required for plugin calls
1 parent 1f725e8 commit 43079a5

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/Plugin/PluginTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,40 @@ function test_defaults()
2828
$this->assertFalse($plugin->merge());
2929
}
3030

31+
/**
32+
* @throws \Throwable
33+
*/
34+
function test_merge_calls_override_parent_method()
35+
{
36+
$app = new App([
37+
'services' => [
38+
'parent' => new Plugin(Config::class, [['a' => '1']], ['set' => ['b' => '2']]),
39+
'child' => new Plugin('parent', [], ['set' => ['c' => '3']], null, true)
40+
]
41+
]);
42+
43+
$this->assertEquals(
44+
new Config(['a' => '1', 'c' => '3']), $app->plugin('child')
45+
);
46+
}
47+
48+
/**
49+
* @throws \Throwable
50+
*/
51+
function test_merge_calls_repeat_method()
52+
{
53+
$app = new App([
54+
'services' => [
55+
'parent' => new Plugin(Config::class, [['a' => '1']], [['set', 'b', '2']]),
56+
'child' => new Plugin('parent', [], [['set', 'c', '3']], null, true)
57+
]
58+
]);
59+
60+
$this->assertEquals(
61+
new Config(['a' => '1', 'b' => '2', 'c' => '3']), $app->plugin('child')
62+
);
63+
}
64+
3165
/**
3266
*
3367
*/

0 commit comments

Comments
 (0)