From 66276640d7b4fdbca8a9798a98979c857f1ebc26 Mon Sep 17 00:00:00 2001 From: Brabli <67018167+Brabli@users.noreply.github.com> Date: Wed, 31 May 2023 11:38:58 +0100 Subject: [PATCH] Test config --- tests/Config/ConfigurationTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/Config/ConfigurationTest.php b/tests/Config/ConfigurationTest.php index 0cb8c16..ae83dda 100644 --- a/tests/Config/ConfigurationTest.php +++ b/tests/Config/ConfigurationTest.php @@ -36,6 +36,30 @@ class ConfigurationTest extends TestCase $this->validateConfig($config); } + public function testThrowsIfNoColoursExist(): void + { + $config = $this->getValidConfig(); + $config['colours'] = []; + $this->expectExceptionMessage("Colours cannot be empty!"); + $this->validateConfig($config); + } + + public function testThrowsIfColourHasMissingClass(): void + { + $config = $this->getValidConfig(); + unset($config['colours']['primary']['fill']); + $this->expectException(\Exception::class); + $this->validateConfig($config); + } + + public function testThrowsIfColourHasExtraClass(): void + { + $config = $this->getValidConfig(); + $config['colours']['primary']['extra'] = "test"; + $this->expectException(\Exception::class); + $this->validateConfig($config); + } + private function validateConfig(array $config): void { $this->processor->processConfiguration($this->configuration, [$config]);