Skip to content

Commit a01d019

Browse files
committed
test():Add InvalidArgumentTypeExceptionTest
1 parent 2bf5823 commit a01d019

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace Alezhu\PHPUnitArrayContainsAsserts\Tests\Exception;
4+
5+
use Alezhu\PHPUnitArrayContainsAsserts\Exception\InvalidArgumentTypeException;
6+
use PHPUnit\Framework\InvalidArgumentException;
7+
use PHPUnit\Framework\TestCase;
8+
9+
class InvalidArgumentTypeExceptionTest extends TestCase
10+
{
11+
12+
public function test_create()
13+
{
14+
$argument = 1;
15+
$type = "array";
16+
17+
$instance = InvalidArgumentTypeException::create($argument, $type);
18+
self::assertInstanceOf(InvalidArgumentTypeException::class, $instance);
19+
20+
$result = $instance->getMessage();
21+
$expect = sprintf("Argument #%d must be %s", $argument, $type);
22+
self::assertEquals($expect, $result);
23+
}
24+
25+
public function test_1_construct()
26+
{
27+
$instance = new InvalidArgumentTypeException(1, "");
28+
self::assertInstanceOf(InvalidArgumentTypeException::class, $instance);
29+
self::assertInstanceOf(InvalidArgumentException::class, $instance);
30+
}
31+
}

0 commit comments

Comments
 (0)