public function testTimeDimensionLoadData()
 {
     $pid = Helper::getSomeProject();
     Helper::cleanUpProject($pid);
     $name = 't' . uniqid();
     $dir = sys_get_temp_dir() . '/' . uniqid();
     mkdir($dir);
     $timeDimension = new TimeDimension($this->client);
     $timeDimension->create($pid, $name);
     $timeDimension->loadData($pid, $name, $dir);
     $result = $this->client->get("/gdc/md/{$pid}/data/sets");
     $this->assertArrayHasKey('dataSetsInfo', $result);
     $this->assertArrayHasKey('sets', $result['dataSetsInfo']);
     $this->assertCount(1, $result['dataSetsInfo']['sets']);
     $this->assertArrayHasKey('meta', $result['dataSetsInfo']['sets'][0]);
     $this->assertArrayHasKey('identifier', $result['dataSetsInfo']['sets'][0]['meta']);
     $this->assertEquals("dataset.time.{$name}", $result['dataSetsInfo']['sets'][0]['meta']['identifier']);
     $this->assertArrayHasKey('lastUpload', $result['dataSetsInfo']['sets'][0]);
     $this->assertArrayHasKey('dataUploadShort', $result['dataSetsInfo']['sets'][0]['lastUpload']);
     $this->assertArrayHasKey('status', $result['dataSetsInfo']['sets'][0]['lastUpload']['dataUploadShort']);
     $this->assertEquals("OK", $result['dataSetsInfo']['sets'][0]['lastUpload']['dataUploadShort']['status']);
 }
Exemplo n.º 2
0
 public static function initProjectModel($pid)
 {
     $client = self::getClient();
     self::cleanUpProject($pid);
     $client->getDateDimensions()->create($pid, 'Date 1');
     $td = new TimeDimension($client);
     $td->create($pid, 'Date 1');
     $model = json_decode(file_get_contents(__DIR__ . '/data/model.json'), true);
     $client->getProjectModel()->updateProject($pid, $model);
 }