for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace TheCodingMachine\GraphQL\Controllers\Types;
use GraphQL\Type\Definition\IDType;
use GraphQL\Type\Schema;
use PHPUnit\Framework\TestCase;
use RuntimeException;
use TheCodingMachine\GraphQL\Controllers\Mappers\CannotMapTypeException;
class TypeResolverTest extends TestCase
{
public function testException()
$typeResolver = new TypeResolver();
$this->expectException(RuntimeException::class);
$typeResolver->mapNameToType('ID');
}
public function testMapNameToType()
$schema = new Schema([]);
$typeResolver->registerSchema($schema);
$this->assertInstanceOf(IDType::class, $typeResolver->mapNameToType('ID'));
$this->expectException(CannotMapTypeException::class);
$typeResolver->mapNameToType('NotExists');