Youshido\Tests\Library\Type\ObjectTypeTest::testFieldsTrait PHP Method

testFieldsTrait() public method

public testFieldsTrait ( )
    public function testFieldsTrait()
    {
        $idField = new Field(['name' => 'id', 'type' => new IntType()]);
        $nameField = new Field(['name' => 'name', 'type' => new StringType()]);
        $objectType = new ObjectType(['name' => 'Post', 'fields' => [$idField], 'description' => 'Post type description']);
        $this->assertTrue($objectType->hasFields());
        $this->assertEquals(['id' => $idField], $objectType->getFields());
        $objectType->addField($nameField);
        $this->assertEquals(['id' => $idField, 'name' => $nameField], $objectType->getFields());
    }