Esempio n. 1
0
 /**
  * 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"]);
 }