From 07b2f175f312db72d8feea77852efb3101c44e3e Mon Sep 17 00:00:00 2001 From: sunxyw Date: Sun, 21 Aug 2022 14:19:53 +0800 Subject: [PATCH] add more test cases --- tests/ZM/Config/RefactoredConfigTest.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/ZM/Config/RefactoredConfigTest.php b/tests/ZM/Config/RefactoredConfigTest.php index b195bcc0..812facb4 100644 --- a/tests/ZM/Config/RefactoredConfigTest.php +++ b/tests/ZM/Config/RefactoredConfigTest.php @@ -85,9 +85,23 @@ class RefactoredConfigTest extends TestCase $this->assertTrue(self::$config->get('test.boolean')); } - public function testGetValue(): void + /** + * @dataProvider providerTestGetValue + */ + public function testGetValue(string $key, $expected): void { - $this->assertSame('bar', self::$config->get('test.foo')); + $this->assertSame($expected, self::$config->get($key)); + } + + public function providerTestGetValue(): array + { + return [ + 'null' => ['test.null', null], + 'boolean' => ['test.boolean', true], + 'associate' => ['test.associate', ['x' => 'xxx', 'y' => 'yyy']], + 'array' => ['test.array', ['aaa', 'zzz']], + 'dot access' => ['test.x.z', 'zoo'], + ]; } public function testGetWithDefault(): void