File: TubeNotFoundExceptionTest.php

package info (click to toggle)
php-pda-pheanstalk 8.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 836 kB
  • sloc: php: 4,713; xml: 19; makefile: 14
file content (26 lines) | stat: -rw-r--r-- 918 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

declare(strict_types=1);

namespace Pheanstalk\Tests\Unit\Exception;

use Pheanstalk\Exception\TubeNotFoundException;
use Pheanstalk\Values\TubeName;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;

#[CoversClass(TubeNotFoundException::class)]
final class TubeNotFoundExceptionTest extends TestCase
{
    #[TestWith(['', 'Tube "[unknown]" not found.', '[unknown]'])]
    #[TestWith(['Custom message', 'Custom message', '[unknown]'])]
    #[TestWith([new TubeName('foo'), 'Tube "foo" not found.', 'foo'])]
    public function testMessageAndTubeAreAsExpected(string|TubeName $message, string $expectedMessage, string $expectedTube): void
    {
        $exception = new TubeNotFoundException($message);

        self::assertSame($expectedMessage, $exception->getMessage());
        self::assertSame($expectedTube, $exception->tube);
    }
}