-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestCase.php
39 lines (33 loc) · 932 Bytes
/
TestCase.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* This file is part of phpfn package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Fun\Symbol\Tests;
use Fun\Symbol\Exception\TypeError;
use PHPUnit\Framework\TestCase as BaseTestCase;
/**
* Class TestCase
*/
abstract class TestCase extends BaseTestCase
{
/**
* @param string $method
* @param string $shouldBe
* @return void
*/
protected function expectInvalidArgumentError(string $method, string $shouldBe): void
{
$this->expectExceptionCode(TypeError::INVALID_ARGUMENT_CODE);
$this->expectExceptionMessageRegExp(\vsprintf(
'/^Argument 1 passed to %s\(\) must be of the type %s, \w+ given/',
[
\preg_quote($method, '/'),
\preg_quote($shouldBe, '/'),
]
));
}
}