-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathObjectTypeTest.php
42 lines (34 loc) · 979 Bytes
/
ObjectTypeTest.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
40
41
42
<?php
declare(strict_types=1);
namespace Cubicl\StructureCheck\Test\Integration\Type;
use PHPUnit\Framework\TestCase;
use Cubicl\StructureCheck\Checker;
use Cubicl\StructureCheck\CheckerInterface;
use Cubicl\StructureCheck\Type\AnyType;
use Cubicl\StructureCheck\Type\ObjectType;
use Cubicl\StructureCheck\Type\OptionalType;
/**
* Class ObjectTypeTest
* @package Cubicl\StructureCheck\Test\Integration\Type
* @author Christian Blank <christian@cubicl.de>
*/
class ObjectTypeTest extends TestCase
{
private CheckerInterface $checker;
protected function setUp(): void
{
parent::setUp();
$this->checker = new Checker();
}
/**
* @test
*/
public function itShouldHandleAbsenceOfOptionalDeclaredType(): void
{
$structure = new ObjectType([
'opt' => new OptionalType(new AnyType())
]);
$actual = $structure->check('', []);
$this->assertSame(true, $actual->isValid());
}
}