GraphQL\Tests\Type\DefinitionTest::setUp PHP Method

setUp() public method

public setUp ( )
    public function setUp()
    {
        $this->objectType = new ObjectType(['name' => 'Object', 'isTypeOf' => function () {
            return true;
        }]);
        $this->interfaceType = new InterfaceType(['name' => 'Interface']);
        $this->unionType = new UnionType(['name' => 'Union', 'types' => [$this->objectType]]);
        $this->enumType = new EnumType(['name' => 'Enum']);
        $this->inputObjectType = new InputObjectType(['name' => 'InputObject']);
        $this->blogImage = new ObjectType(['name' => 'Image', 'fields' => ['url' => ['type' => Type::string()], 'width' => ['type' => Type::int()], 'height' => ['type' => Type::int()]]]);
        $this->blogAuthor = new ObjectType(['name' => 'Author', 'fields' => function () {
            return ['id' => ['type' => Type::string()], 'name' => ['type' => Type::string()], 'pic' => ['type' => $this->blogImage, 'args' => ['width' => ['type' => Type::int()], 'height' => ['type' => Type::int()]]], 'recentArticle' => $this->blogArticle];
        }]);
        $this->blogArticle = new ObjectType(['name' => 'Article', 'fields' => ['id' => ['type' => Type::string()], 'isPublished' => ['type' => Type::boolean()], 'author' => ['type' => $this->blogAuthor], 'title' => ['type' => Type::string()], 'body' => ['type' => Type::string()]]]);
        $this->blogQuery = new ObjectType(['name' => 'Query', 'fields' => ['article' => ['type' => $this->blogArticle, 'args' => ['id' => ['type' => Type::string()]]], 'feed' => ['type' => new ListOfType($this->blogArticle)]]]);
        $this->blogMutation = new ObjectType(['name' => 'Mutation', 'fields' => ['writeArticle' => ['type' => $this->blogArticle]]]);
        $this->blogSubscription = new ObjectType(['name' => 'Subscription', 'fields' => ['articleSubscribe' => ['args' => ['id' => ['type' => Type::string()]], 'type' => $this->blogArticle]]]);
    }