3 include_once __DIR__ . '/parse_args.php';
5 class DebuggerTest 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 public function setUp()
46 $this->args = argParser::getArgs();
48 $this->baseUrl = $this->args['LOCALSERVER'] . str_replace( '/demo/server/server.php', '/debugger/', $this->args['URI'] );
50 $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] );
53 protected function request($file, $method = 'GET', $payload = '')
55 $url = $this->baseUrl . $file;
57 $ch = curl_init($url);
58 curl_setopt_array($ch, array(
59 CURLOPT_RETURNTRANSFER => true,
60 CURLOPT_FAILONERROR => true
62 if ($method == 'POST')
64 curl_setopt_array($ch, array(
66 CURLOPT_POSTFIELDS => $payload
69 if ($this->collectCodeCoverageInformation)
71 curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID=true');
73 if ($this->args['DEBUG'] > 0) {
74 curl_setopt($ch, CURLOPT_VERBOSE, 1);
76 $page = curl_exec($ch);
79 $this->assertNotFalse($page);
80 $this->assertNotContains('Fatal error', $page);
81 $this->assertNotContains('Notice:', $page);
86 public function testIndex()
88 $page = $this->request('index.php');
91 public function testController()
93 $page = $this->request('controller.php');
103 public function testAction()
105 $page = $this->request('action.php');