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);
}
}
|