Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Add unit to api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrauer committed Aug 15, 2015
1 parent 26b1e0b commit 47585a9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/tracker/tests/controllers/ApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function testUploadScalarWithSubmission()

$outputs = array();
$outputs['metric_0'] = $this->_submitScalar($token, $uuid, 'metric_0', '18');
$outputs['metric_1'] = $this->_submitScalar($token, $uuid, 'metric_1', '19');
$outputs['metric_2'] = $this->_submitScalar($token, $uuid, 'metric_2', '20');
$outputs['metric_1'] = $this->_submitScalar($token, $uuid, 'metric_1', '19', 'meters');
$outputs['metric_2'] = $this->_submitScalar($token, $uuid, 'metric_2', '20', 'mm');

/** @var Tracker_SubmissionModel $submissionModel */
$submissionModel = MidasLoader::loadModel('Submission', 'tracker');
Expand All @@ -75,9 +75,10 @@ public function testUploadScalarWithSubmission()
* @param string $uuid the uuid of the submission
* @param string $metric the metric name of the trend
* @param float $value the scalar value
* @param string $unit the unit of the trend, defaults to false
* @return mixed response object from the API
*/
protected function _submitScalar($token, $uuid, $metric, $value)
protected function _submitScalar($token, $uuid, $metric, $value, $unit = false)
{
$this->resetAll();
$this->params['method'] = 'midas.tracker.scalar.add';
Expand All @@ -89,6 +90,9 @@ protected function _submitScalar($token, $uuid, $metric, $value)
$this->params['producerRevision'] = 'deadbeef';
$this->params['submitTime'] = 'now';
$this->params['submissionUuid'] = $uuid;
if ($unit !== false) {
$this->params['unit'] = $unit;
}

$res = $this->_callJsonApi();

Expand Down

0 comments on commit 47585a9

Please sign in to comment.