TestGetParameter_30.php 1.17 KB
<?php

require_once "Base/TestDownloadBase.php";

class TestGetParameter_30 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",
		);
	}

	public function getDescription() {
		return "Get imf data. No sampling.";
	}

	protected function checkResultInfo($info) {
		if ($info['structure'] != 'one-file-per-parameter-per-interval') {
			return array(
				'success' => FALSE,
				'message' => 'Bad file structure ('.$info['structure'].')',
			);
		}
		if (isset($info['sampling'])) {
			return array(
				'success' => FALSE,
				'message' => 'A sampling time has been applied in result file',
			);
		}
		if ($info['timeFormat'] != 'ISO 8601') {
			return array(
				'success' => FALSE,
				'message' => 'Bad time format ('.$info['timeFormat'].')',
			);
		}
		if (!in_array('imf', $info['parameters'])) {
			return array(
				'success' => FALSE,
				'message' => 'Missing imf in result file',
			);
		}
		return array(
			'success' => TRUE,
		);
	}
}

?>