3 include_once __DIR__ . '/parse_args.php';
5 include_once __DIR__ . '/PolyfillTestCase.php';
7 abstract class PhpXmlRpc_LocalFileTestCase extends PhpXmlRpc_PolyfillTestCase
9 public $args = array();
14 /** @var boolean $collectCodeCoverageInformation */
15 protected $collectCodeCoverageInformation;
16 protected $coverageScriptUrl;
18 public function _run($result = NULL)
20 $this->testId = get_class($this) . '__' . $this->getName();
22 if ($result === NULL) {
23 $result = $this->createResult();
26 $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
28 parent::_run($result);
30 if ($this->collectCodeCoverageInformation) {
31 $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage(
32 $this->coverageScriptUrl,
35 $result->getCodeCoverage()->append(
36 $coverage->get(), $this
40 // do not call this before to give the time to the Listeners to run
41 //$this->getStrategy()->endOfTest($this->session);
46 protected function request($file, $method = 'GET', $payload = '', $emptyPageOk = false)
48 $url = $this->baseUrl . $file;
50 $ch = curl_init($url);
51 curl_setopt_array($ch, array(
52 CURLOPT_RETURNTRANSFER => true,
53 CURLOPT_FAILONERROR => true
55 if ($method == 'POST')
57 curl_setopt_array($ch, array(
59 CURLOPT_POSTFIELDS => $payload
62 if ($this->collectCodeCoverageInformation)
64 curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID=true');
66 if ($this->args['DEBUG'] > 0) {
67 curl_setopt($ch, CURLOPT_VERBOSE, 1);
69 $page = curl_exec($ch);
72 $this->assertNotFalse($page);
74 $this->assertNotEquals('', $page);
76 $this->assertStringNotContainsStringIgnoringCase('Fatal error', $page);
77 $this->assertStringNotContainsStringIgnoringCase('Notice:', $page);