packages/sql-catalog/tests/Unit/Cli/WriteFailureExceptionTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Cli;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\TestCase;
9use SqlCatalog\Cli\WriteFailureException;
10
11#[CoversClass(WriteFailureException::class)]
12final class WriteFailureExceptionTest extends TestCase
13{
14    public function testMessageNamesThePathAndTheReason(): void
15    {
16        $exception = new WriteFailureException('out/catalog.json', 'the file could not be written');
17        self::assertSame('Cannot write "out/catalog.json": the file could not be written.', $exception->getMessage());
18        self::assertSame('out/catalog.json', $exception->path);
19    }
20}
21