Google\Cloud\Tests\System\BigQuery\LoadDataAndQueryTest::testRunQueryAsJob PHP Method

testRunQueryAsJob() public method

public testRunQueryAsJob ( )
    public function testRunQueryAsJob()
    {
        $job = self::$client->runQueryAsJob(sprintf('SELECT * FROM [%s.%s]', self::$dataset->id(), self::$table->id()));
        $results = $job->queryResults();
        $backoff = new ExponentialBackoff(8);
        $backoff->execute(function () use($results) {
            $results->reload();
            if (!$results->isComplete()) {
                throw new \Exception();
            }
        });
        if (!$results->isComplete()) {
            $this->fail('Query did not complete within the allotted time.');
        }
        $actualRows = count(iterator_to_array($results->rows()));
        $this->assertEquals(self::$expectedRows, $actualRows);
    }