add more test cases

This commit is contained in:
sunxyw 2022-08-21 14:19:53 +08:00
parent 1a1c65afce
commit 07b2f175f3
No known key found for this signature in database
GPG Key ID: F391C42B19AFFC98

View File

@ -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