3 include_once __DIR__ . '/parse_args.php';
5 include_once __DIR__ . '/PolyfillTestCase.php';
7 use PHPUnit\Framework\TestResult;
9 abstract class PhpXmlRpc_LocalFileTestCase extends PhpXmlRpc_PolyfillTestCase
11 public $args = array();
16 /** @var boolean $collectCodeCoverageInformation */
17 protected $collectCodeCoverageInformation;
18 protected $coverageScriptUrl;
20 public function _run(TestResult $result = NULL)
22 $this->testId = get_class($this) . '__' . $this->getName();
24 if ($result === NULL) {
25 $result = $this->createResult();
28 $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
30 parent::_run($result);
32 if ($this->collectCodeCoverageInformation) {
33 $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage(
34 $this->coverageScriptUrl,
37 $result->getCodeCoverage()->append(
38 $coverage->get(), $this
42 // do not call this before to give the time to the Listeners to run
43 //$this->getStrategy()->endOfTest($this->session);
48 protected function request($file, $method = 'GET', $payload = '', $emptyPageOk = false)
50 $url = $this->baseUrl . $file;
52 $ch = curl_init($url);
53 curl_setopt_array($ch, array(
54 CURLOPT_RETURNTRANSFER => true,
55 CURLOPT_FAILONERROR => true
57 if ($method == 'POST')
59 curl_setopt_array($ch, array(
61 CURLOPT_POSTFIELDS => $payload
64 if ($this->collectCodeCoverageInformation)
66 curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID=true');
68 if ($this->args['DEBUG'] > 0) {
69 curl_setopt($ch, CURLOPT_VERBOSE, 1);
71 $page = curl_exec($ch);
74 $this->assertNotFalse($page);
76 $this->assertNotEquals('', $page);
78 $this->assertNotContains('Fatal error', $page);
79 $this->assertNotContains('Notice:', $page);