3 include_once __DIR__ . '/parse_args.php';
5 abstract class PhpXmlRpc_LocalFileTestCase extends PHPUnit_Framework_TestCase
7 public $args = array();
12 /** @var boolean $collectCodeCoverageInformation */
13 protected $collectCodeCoverageInformation;
14 protected $coverageScriptUrl;
16 public function run(PHPUnit_Framework_TestResult $result = NULL)
18 $this->testId = get_class($this) . '__' . $this->getName();
20 if ($result === NULL) {
21 $result = $this->createResult();
24 $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
28 if ($this->collectCodeCoverageInformation) {
29 $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage(
30 $this->coverageScriptUrl,
33 $result->getCodeCoverage()->append(
34 $coverage->get(), $this
38 // do not call this before to give the time to the Listeners to run
39 //$this->getStrategy()->endOfTest($this->session);
44 protected function request($file, $method = 'GET', $payload = '', $emptyPageOk = false)
46 $url = $this->baseUrl . $file;
48 $ch = curl_init($url);
49 curl_setopt_array($ch, array(
50 CURLOPT_RETURNTRANSFER => true,
51 CURLOPT_FAILONERROR => true
53 if ($method == 'POST')
55 curl_setopt_array($ch, array(
57 CURLOPT_POSTFIELDS => $payload
60 if ($this->collectCodeCoverageInformation)
62 curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID=true');
64 if ($this->args['DEBUG'] > 0) {
65 curl_setopt($ch, CURLOPT_VERBOSE, 1);
67 $page = curl_exec($ch);
70 $this->assertNotFalse($page);
72 $this->assertNotEquals('', $page);
74 $this->assertNotContains('Fatal error', $page);
75 $this->assertNotContains('Notice:', $page);