public function testLoadsDataFromStorageToTable()
{
$object = self::$bucket->upload(fopen(__DIR__ . '/../data/table-data.csv', 'r'));
self::$deletionQueue[] = $object;
$job = self::$table->loadFromStorage($object, ['jobConfig' => ['sourceFormat' => 'CSV']]);
$backoff = new ExponentialBackoff(8);
$backoff->execute(function () use($job) {
$job->reload();
if (!$job->isComplete()) {
throw new \Exception();
}
});
if (!$job->isComplete()) {
$this->fail('Job failed to complete within the allotted time.');
}
self::$expectedRows += count(file(__DIR__ . '/../data/table-data.csv'));
$actualRows = count(iterator_to_array(self::$table->rows()));
$this->assertEquals(self::$expectedRows, $actualRows);
}