| Total Complexity | 6 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | abstract class ConfigTest extends PluginTestCase |
||
| 12 | { |
||
| 13 | protected function setUp(): void |
||
| 14 | { |
||
| 15 | $this->registerConfig($this->getDefaultConfigName()); |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @dataProvider configProvider() |
||
| 20 | * @param string $name |
||
| 21 | * @param $expectedValue |
||
| 22 | * @param string|null $configName |
||
| 23 | */ |
||
| 24 | public function testConfig(string $name, $expectedValue, string $configName = null): void |
||
| 25 | { |
||
| 26 | $actualValue = $this->getConfigValue($name, $configName); |
||
| 27 | if ($expectedValue instanceof Closure) { |
||
| 28 | $expectedValue($actualValue); |
||
| 29 | return; |
||
| 30 | } |
||
| 31 | if ($expectedValue instanceof LiterallyCallback) { |
||
| 32 | $expectedValue = $expectedValue->getCallback(); |
||
| 33 | } |
||
| 34 | |||
| 35 | $this->assertEquals($expectedValue, $actualValue); |
||
| 36 | } |
||
| 37 | |||
| 38 | protected function getConfigValue(string $name, string $configName = null) |
||
| 44 | } |
||
| 45 | |||
| 46 | abstract protected function getDefaultConfigName(): string; |
||
| 47 | } |
||
| 48 |