|
13 | 13 | use Hyde\Framework\Exceptions\ParseException; |
14 | 14 | use RuntimeException; |
15 | 15 | use Exception; |
| 16 | +use Hyde\Framework\Exceptions\InvalidConfigurationException; |
16 | 17 |
|
17 | 18 | /** |
18 | 19 | * @covers \Hyde\Framework\Exceptions\FileConflictException |
19 | 20 | * @covers \Hyde\Framework\Exceptions\FileNotFoundException |
20 | 21 | * @covers \Hyde\Framework\Exceptions\RouteNotFoundException |
21 | 22 | * @covers \Hyde\Framework\Exceptions\UnsupportedPageTypeException |
| 23 | + * @covers \Hyde\Framework\Exceptions\InvalidConfigurationException |
22 | 24 | * @covers \Hyde\Framework\Exceptions\ParseException |
23 | 25 | */ |
24 | 26 | class CustomExceptionsTest extends UnitTestCase |
@@ -173,4 +175,30 @@ public function testParseExceptionWithPrevious() |
173 | 175 | $this->assertSame("Invalid Markdown in file: 'example.md' (Parsing error)", $exception->getMessage()); |
174 | 176 | $this->assertSame($previous, $exception->getPrevious()); |
175 | 177 | } |
| 178 | + |
| 179 | + public function testInvalidConfigurationExceptionWithDefaultMessage() |
| 180 | + { |
| 181 | + $exception = new InvalidConfigurationException(); |
| 182 | + |
| 183 | + $this->assertSame('Invalid configuration detected.', $exception->getMessage()); |
| 184 | + } |
| 185 | + |
| 186 | + public function testInvalidConfigurationExceptionWithCustomMessage() |
| 187 | + { |
| 188 | + $exception = new InvalidConfigurationException('Custom error message.'); |
| 189 | + |
| 190 | + $this->assertSame('Custom error message.', $exception->getMessage()); |
| 191 | + } |
| 192 | + |
| 193 | + public function testInvalidConfigurationExceptionWithNamespaceAndKey() |
| 194 | + { |
| 195 | + $exception = new InvalidConfigurationException('Invalid configuration.', 'hyde', 'name'); |
| 196 | + |
| 197 | + $this->assertSame('Invalid configuration.', $exception->getMessage()); |
| 198 | + $this->assertFileExists($exception->getFile()); |
| 199 | + $this->assertIsInt($exception->getLine()); |
| 200 | + |
| 201 | + $this->assertStringContainsString('config'.DIRECTORY_SEPARATOR.'hyde.php', $exception->getFile()); |
| 202 | + $this->assertGreaterThan(0, $exception->getLine()); |
| 203 | + } |
176 | 204 | } |
0 commit comments