tests/Schema/SchemaContainerTest.php
/**
     * Test register and get schema.
     */
Test register and get schema.
Test register and get schema .
public function testRegisterAndGet(): void
    {
        $factory       = $this->createFactory();
        $commentSchema = new CommentSchema($factory);
        $postSchema    = new PostSchema($factory);
        $container     = $factory->createSchemaContainer([
            Author::class  => AuthorSchema::class,
            Comment::class => $commentSchema,
            Post::class    => function () use ($postSchema): SchemaInterface {
                return $postSchema;
            },
        ]);
        $author  = $this->createAuthor();
        $comment = $this->createComment();
        $post    = $this->createPost();
        self::assertTrue($container->hasSchema($author));
        self::assertNotNull($container->getSchema($author));
        self::assertTrue($container->hasSchema($comment));
        self::assertSame($commentSchema, $container->getSchema($comment));
        self::assertTrue($container->hasSchema($post));
        self::assertSame($postSchema, $container->getSchema($post));
    }
public function testRegisterAndGet ( ) : void { $ factory = $ this -> createFactory ( ) ; $ commentSchema = new CommentSchema ( $ factory ) ; $ postSchema = new PostSchema ( $ factory ) ; $ container = $ factory -> createSchemaContainer ( [ Author :: class => AuthorSchema :: class , Comment :: class => $ commentSchema , Post :: class => function ( ) use ( $ postSchema ) : SchemaInterface { return $ postSchema ; } , ] ) ; $ author = $ this -> createAuthor ( ) ; $ comment = $ this -> createComment ( ) ; $ post = $ this -> createPost ( ) ; self :: assertTrue ( $ container -> hasSchema ( $ author ) ) ; self :: assertNotNull ( $ container -> getSchema ( $ author ) ) ; self :: assertTrue ( $ container -> hasSchema ( $ comment ) ) ; self :: assertSame ( $ commentSchema , $ container -> getSchema ( $ comment ) ) ; self :: assertTrue ( $ container -> hasSchema ( $ post ) ) ; self :: assertSame ( $ postSchema , $ container -> getSchema ( $ post ) ) ; }
Test register and get schema.
Test register and get schema .