TestGetParameter_31.php 1.68 KB
<?php

require_once "Base/TestDownloadBase.php";

class TestGetParameter_31 extends TestDownloadBase
{
	public function getAPI() {
		return "getParameter";
	}

	protected function needRESTAuth() {
		return TRUE;
	}

	public function getParams() {
		return array(
			"startTime" => "2008-01-01T00:00:00",
			"stopTime"  => "2008-01-01T01:00:00",
			"parameterID" => "imf",
			"sampling" => 60,
			"timeFormat" => 'UNIXTIME',
			"gzip" => 1,
			"outputFormat" => "VOTable",
		);
	}

	public function getDescription() {
		return "Get imf data. Sampling time 60s. Unix time. VOTable. Compressed";
	}

	protected function checkResultInfo($info) {
		if ($info['structure'] != 'all-in-one-file') {
			return array(
				'success' => FALSE,
				'message' => 'Bad file structure ('.$info['structure'].')',
			);
		}
		if (!isset($info['sampling'])) {
			return array(
				'success' => FALSE,
				'message' => 'Missing sampling time',
			);
		}
		else if ($info['sampling'] != 60) {
			return array(
				'success' => FALSE,
				'message' => 'Bad sampling time ('.$info['sampling'].')',
			);
		}
		if ($info['timeFormat'] != 'Seconds from 1970, milliseconds') {
			return array(
				'success' => FALSE,
				'message' => 'Bad time format ('.$info['timeFormat'].')',
			);
		}
		if (!$info['compressed']) {
			return array(
				'success' => FALSE,
				'message' => 'Result file is not compressed',
			);
		}
		if (!$info['isVOTable']) {
			return array(
				'success' => FALSE,
				'message' => 'Result file not in VOTable format'
			);
		}
		if (!in_array('imf', $info['parameters'])) {
			return array(
				'success' => FALSE,
				'message' => 'Missing imf in result file',
			);
		}
		return array(
			'success' => TRUE,
		);
	}
}

?>