Google\Cloud\Tests\Snippets\Datastore\Query\GqlQueryTest::testClass PHP Method

testClass() public method

public testClass ( )
    public function testClass()
    {
        $this->connection->runQuery(Argument::any())->shouldBeCalled()->willReturn(['batch' => ['entityResults' => [['entity' => ['key' => ['path' => []], 'properties' => ['companyName' => ['stringValue' => 'Google']]]]]]]);
        $this->operation->setConnection($this->connection->reveal());
        $snippet = $this->snippetFromClass(GqlQuery::class);
        $snippet->addLocal('operation', $this->operation);
        $snippet->insertAfterLine(3, '$reflection = new \\ReflectionClass($datastore);
            $property = $reflection->getProperty(\'operation\');
            $property->setAccessible(true);
            $property->setValue($datastore, $operation);
            $property->setAccessible(false);');
        $res = $snippet->invoke(['query', 'res']);
        $this->assertEquals('Google', $res->output());
        $this->assertInstanceOf(\Generator::class, $res->returnVal()[1]);
        $this->assertTrue(array_key_exists('namedBindings', $res->returnVal()[0]->queryObject()));
    }