/**
  * @test
  */
 public function createReRunUrlEscapesAmpersands()
 {
     /** @var \PHPUnit_Framework_TestCase|\PHPUnit_Framework_TestSuite $test */
     $test = $this->getMock('PHPUnit_Framework_TestCase', array(), array('myTest'));
     $this->subject->setTestSuiteName('myTestCase');
     self::assertContains('&', $this->subject->createReRunUrl($test));
 }
 /**
  * @test
  */
 public function createReRunUrlEscapesAmpersands()
 {
     /** @var $test PHPUnit_Framework_TestCase|PHPUnit_Framework_TestSuite */
     $test = $this->getMock('PHPUnit_Framework_TestCase', array(), array('myTest'));
     $this->fixture->setTestSuiteName('myTestCase');
     $this->assertContains('&', $this->fixture->createReRunUrl($test));
 }
Exemple #3
0
 /**
  * Runs a testcase as given in the GET/POST variable "testCaseFile".
  *
  * @param PHPUnit_Framework_TestSuite $testSuiteWithAllTestCases suite with all test cases
  * @param PHPUnit_Framework_TestResult $testResult the test result (will be modified)
  *
  * @return void
  */
 protected function runTestCase(PHPUnit_Framework_TestSuite $testSuiteWithAllTestCases, PHPUnit_Framework_TestResult $testResult)
 {
     $testCaseFileName = $this->request->getAsString(Tx_Phpunit_Interface_Request::PARAMETER_KEY_TESTCASE);
     $this->testListener->setTestSuiteName($testCaseFileName);
     $suiteNameHasBeenDisplayed = FALSE;
     $totalNumberOfTestCases = 0;
     foreach ($testSuiteWithAllTestCases->tests() as $testSuite) {
         /** @var \PHPUnit_Framework_TestSuite $testSuite */
         foreach ($testSuite->tests() as $test) {
             if ($test instanceof PHPUnit_Framework_TestSuite) {
                 $testIdentifierParts = explode('::', $test->getName());
                 $testIdentifier = $testIdentifierParts[0];
             } else {
                 $testIdentifier = get_class($test);
             }
             if ($testIdentifier === $testCaseFileName) {
                 if ($test instanceof PHPUnit_Framework_TestSuite) {
                     $totalNumberOfTestCases += $test->count();
                 } else {
                     $totalNumberOfTestCases++;
                 }
             }
         }
     }
     $this->testListener->setTotalNumberOfTests($totalNumberOfTestCases);
     $this->renderProgressbar();
     foreach ($testSuiteWithAllTestCases->tests() as $testSuite) {
         /** @var \PHPUnit_Framework_TestSuite $testSuite */
         foreach ($testSuite->tests() as $test) {
             if ($test instanceof PHPUnit_Framework_TestSuite) {
                 $testIdentifierParts = explode('::', $test->getName());
                 $testIdentifier = $testIdentifierParts[0];
             } else {
                 $testIdentifier = get_class($test);
             }
             if ($testIdentifier === $testCaseFileName) {
                 if (!$suiteNameHasBeenDisplayed) {
                     $this->outputService->output('<h2 class="testSuiteName">Testsuite: ' . $testCaseFileName . '</h2>');
                     $suiteNameHasBeenDisplayed = TRUE;
                 }
                 $test->run($testResult);
             }
         }
     }
     if (!is_object($testResult)) {
         $this->outputService->output('<h2 class="hadError">Error</h2><p>The test <strong> ' . htmlspecialchars($this->request->getAsString(Tx_Phpunit_Interface_Request::PARAMETER_KEY_TEST)) . '</strong> could not be found.</p>');
         return;
     }
 }