Youshido\GraphQL\Parser\Ast\Query::hasArguments PHP Method

hasArguments() public method

public hasArguments ( )
    public function hasArguments()
    {
        return (bool) count($this->arguments);
    }

Usage Example

Exemplo n.º 1
0
 public function testQuery()
 {
     $arguments = [new Argument('limit', new Literal('10', new Location(1, 1)), new Location(1, 1))];
     $fields = [new Field('id', null, [], new Location(1, 1))];
     $query = new Query('ships', 'lastShips', $arguments, $fields, new Location(1, 1));
     $this->assertEquals('ships', $query->getName());
     $this->assertEquals('lastShips', $query->getAlias());
     $this->assertEquals($arguments, $query->getArguments());
     $this->assertEquals(['limit' => '10'], $query->getKeyValueArguments());
     $this->assertEquals($fields, $query->getFields());
     $this->assertTrue($query->hasArguments());
     $this->assertTrue($query->hasFields());
     $query->setFields([]);
     $query->setArguments([]);
     $this->assertEmpty($query->getArguments());
     $this->assertEmpty($query->getFields());
     $this->assertEmpty($query->getKeyValueArguments());
     $this->assertFalse($query->hasArguments());
     $this->assertFalse($query->hasFields());
     $query->addArgument(new Argument('offset', new Literal(10, new Location(1, 1)), new Location(1, 1)));
     $this->assertTrue($query->hasArguments());
 }