Ejemplo n.º 1
0
 /**
  * Checks getJobs() returns empty array when no jobs are set.
  */
 public function testGetJobs_returnsEmptyWithNoJobs()
 {
     $folder = JasperTestUtils::createFolder();
     $this->jc->putResource('', $folder);
     $jobs = $this->jc->getJobs();
     // Cleanup
     $this->jc->deleteResource($folder->getUriString());
     $this->assertEquals(0, count($jobs));
 }
Ejemplo n.º 2
0
 /**
  * Checks putResource() with Data Source - whether it actually puts the data source Resource on the server.
  */
 public function testPutResource_withDataSource()
 {
     $folder = JasperTestUtils::createFolder();
     $datasource = JasperTestUtils::createDataSource($folder);
     $this->jc->putResource('', $folder);
     $this->jc->putResource($folder->getUriString(), $datasource);
     $datasource_data = $this->jc->getResource($datasource->getUriString());
     $this->jc->deleteResource($datasource->getUriString());
     $this->jc->deleteResource($folder->getUriString());
     $this->assertEquals($datasource_data->getName(), $datasource->getName());
 }
 /**
  * Checks updatePermissions() - verifies that this method actually sets Permissions for a resource
  * different than folder (in this case, an image).
  */
 public function testPostPermissionsToResource_addsPermissionCorrectly()
 {
     $this->jc->putResource('/', $this->test_folder);
     $resource = JasperTestUtils::createImage($this->test_folder);
     $this->jc->putResource('', $resource, dirname(__FILE__) . '/resources/pitbull.jpg');
     $resource = $this->jc->getResource($resource->getUriString());
     $joeuser = $this->jc->getUsers('joeuser');
     $perms = $this->jc->getPermissions($resource->getUriString());
     $perm = new Permission('32', $joeuser[0], $resource->getUriString());
     $perms[] = $perm;
     $this->jc->updatePermissions($resource->getUriString(), $perms);
     $updated_perms = $this->jc->getPermissions($resource->getUriString());
     $this->jc->deleteResource($this->test_folder->getUriString());
     $this->assertEquals(sizeof($perms), sizeof($updated_perms));
     $this->assertEquals($perm->getPermissionMask(), $updated_perms[count($updated_perms) - 1]->getPermissionMask());
     $this->assertEquals($perm->getPermissionRecipient(), $updated_perms[count($updated_perms) - 1]->getPermissionRecipient());
 }
Ejemplo n.º 4
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"]);
 }