mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 14:25:38 +08:00
add array replace feature
This commit is contained in:
@@ -44,6 +44,9 @@ class RefactoredConfigTest extends TestCase
|
||||
'b.c' => 'd',
|
||||
],
|
||||
'global' => 'yes',
|
||||
'another array' => [
|
||||
'foo', 'bar',
|
||||
],
|
||||
];
|
||||
|
||||
// 下方测试需要临时写入的文件
|
||||
@@ -58,7 +61,7 @@ class RefactoredConfigTest extends TestCase
|
||||
);
|
||||
file_put_contents(
|
||||
$mock_dir . '/test.patch.php',
|
||||
'<?php return ["patch" => "yes"];'
|
||||
'<?php return ["patch" => "yes", "another array" => ["far", "baz"]];'
|
||||
);
|
||||
|
||||
$config = new RefactoredConfig([
|
||||
@@ -158,4 +161,11 @@ class RefactoredConfigTest extends TestCase
|
||||
'invalid' => ['test.patch.development', 'undefined'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testArrayReplaceInsteadOfMerge(): void
|
||||
{
|
||||
// using of space inside config key is not an officially supported feature,
|
||||
// it may be removed in the future, please avoid using it in your project.
|
||||
$this->assertSame(['far', 'baz'], self::$config->get('test.another array'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user