-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathResolveUtilsTest.php
47 lines (39 loc) · 1.42 KB
/
ResolveUtilsTest.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
43
44
45
46
47
<?php
namespace TheCodingMachine\GraphQLite;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
use PHPUnit\Framework\TestCase;
use stdClass;
class ResolveUtilsTest extends TestCase
{
public function testAssertNull(): void
{
$this->expectException(TypeMismatchRuntimeException::class);
ResolveUtils::assertInnerReturnType(null, Type::nonNull(Type::string()));
}
public function testAssertList(): void
{
$this->expectException(TypeMismatchRuntimeException::class);
ResolveUtils::assertInnerReturnType(12, Type::nonNull(Type::listOf(Type::string())));
}
public function testAssertObjectOk(): void
{
ResolveUtils::assertInnerReturnType(new stdClass(), new ObjectType(['name'=>'foo']));
$this->assertTrue(true);
}
public function testAssertInputNull(): void
{
$this->expectException(TypeMismatchRuntimeException::class);
ResolveUtils::assertInnerInputType(null, Type::nonNull(Type::string()));
}
public function testAssertInputList(): void
{
$this->expectException(TypeMismatchRuntimeException::class);
ResolveUtils::assertInnerInputType(12, Type::nonNull(Type::listOf(Type::string())));
}
public function testAssertInputObjectOk(): void
{
ResolveUtils::assertInnerInputType(new stdClass(), new ObjectType(['name'=>'foo']));
$this->assertTrue(true);
}
}