public function testReportIsDone()
 {
     $report = new Report(new AtomxAccountStore());
     $rData = $report->status(Report::getReportId($this->getReportData()));
     var_dump($rData);
     $this->assertEquals(true, Report::isReady($rData));
 }
 public function runAndDownload($json, $timeout = 120, $returnReportId = false)
 {
     $reportData = $this->run($json);
     $secondsWaiting = 0;
     while (!Report::isReady($this->status(Report::getReportId($reportData)))) {
         sleep(1);
         if (++$secondsWaiting >= $timeout) {
             return false;
         }
     }
     if ($returnReportId) {
         return [$this->download($reportData), Report::getReportId($reportData)];
     } else {
         return $this->download($reportData);
     }
 }