mirror of
https://github.com/Respect/Validation.git
synced 2024-06-08 08:42:15 +02:00
d1f108dc87
This commit will ensure that all rules that cannot be created because of invalid arguments in the constructor will throw the InvalidRuleConstructorException. It will also make ComponentException extend LogicException, which makes it easier to determine that the client has improperly used the library. I also introduced some tests for two exceptions with logic in their constructor. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
29 lines
795 B
PHP
29 lines
795 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Exceptions;
|
|
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
use Respect\Validation\Test\TestCase;
|
|
|
|
#[CoversClass(MissingComposerDependencyException::class)]
|
|
final class MissingComposerDependencyExceptionTest extends TestCase
|
|
{
|
|
#[Test]
|
|
public function itShouldCreateMessageForMultipleDependencies(): void
|
|
{
|
|
$exception = new MissingComposerDependencyException('message', 'dependency1', 'dependency2');
|
|
|
|
$expected = 'message. Run `composer require dependency1 dependency2` to fix this issue.';
|
|
|
|
self::assertEquals($expected, $exception->getMessage());
|
|
}
|
|
}
|