/** * Does a non-strict sanity check on ReportOptions service. */ public function testCreateOptions_CreatesNewOptions() { $timecode = substr(md5(microtime()), 0, 5); $label = 'test' . $timecode; $controlOptions = array('Country_multi_select' => array('USA')); $this->jc->updateReportOptions($this->report_uri, $controlOptions, $label, 'true'); $options = $this->jc->getReportOptions($this->report_uri); foreach ($options as $o) { if ($o->getLabel() == $label) { $this->testSuccess = true; } } $this->jc->deleteReportOptions($this->report_uri, $label); $this->assertTrue($this->testSuccess); }
/** * Checks running a report with custom options when this report has input controls of various types. */ public function testRunSalesByMonthReport() { $options = array("TextInput" => array("1234"), "CheckboxInput" => array("false"), "ListInput" => array("3"), "DateInput" => array("2012-09-08"), "QueryInput" => array("sally")); $report = $this->jc->runReport('/reports/samples/SalesByMonth', 'csv', null, $options); $this->assertRegExp("/Number\\,*[0-9\\s]*[\\,\\s]*List\\ item\\,*([0-9]+\\s*)*[\\,\\s]*Date\\,*([0-9]{1,2}\\s+\\w*\\s+[0-9]{4})[\\,\\s]*Query\\ item\\,*sally/u", $report); $this->jc->updateReportOptions('/reports/samples/SalesByMonth', $options, 'SalesByMonthTestOptions', 'true'); $savedOptions = $this->jc->getReportInputControls('/reports/samples/SalesByMonthTestOptions'); try { $this->jc->deleteReportOptions('/reports/samples/SalesByMonth', 'SalesByMonthTestOptions'); } catch (Exception $e) { $this->jc->deleteResource('/reports/samples/SalesByMonthTestOptions'); } $this->assertEquals(1234, (int) $savedOptions[0]->value); $this->assertEquals("false", $savedOptions[1]->value); $this->assertEquals("false", $savedOptions[2]->options[0]["selected"]); $this->assertEquals("false", $savedOptions[2]->options[1]["selected"]); $this->assertEquals("true", $savedOptions[2]->options[2]["selected"]); $this->assertEquals("2012-09-08", $savedOptions[3]->value); $this->assertEquals("true", $savedOptions[4]->options[6]["selected"]); }