X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2F5DemofilesTest.php;h=b7a38716596c43d72578486799d3568f9ec88539;hb=4bc0f6904a12381079bec46ad648f6170f07d449;hp=8f790d3b7a06cc8859c23f2c83b435340e35fbb6;hpb=c8a412d48733f671db6ba149659b816c2e14fd3a;p=plcapi.git diff --git a/tests/5DemofilesTest.php b/tests/5DemofilesTest.php index 8f790d3..b7a3871 100644 --- a/tests/5DemofilesTest.php +++ b/tests/5DemofilesTest.php @@ -1,46 +1,9 @@ testId = get_class($this) . '__' . $this->getName(); - - if ($result === NULL) { - $result = $this->createResult(); - } - - $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation(); - - parent::run($result); - - if ($this->collectCodeCoverageInformation) { - $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage( - $this->coverageScriptUrl, - $this->testId - ); - $result->getCodeCoverage()->append( - $coverage->get(), $this - ); - } - - // do not call this before to give the time to the Listeners to run - //$this->getStrategy()->endOfTest($this->session); - - return $result; - } - public function setUp() { $this->args = argParser::getArgs(); @@ -50,39 +13,6 @@ class DemoFilesTest extends PHPUnit_Framework_TestCase $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] ); } - protected function request($file, $method = 'GET', $payload = '') - { - $url = $this->baseUrl . $file; - - $ch = curl_init($url); - curl_setopt_array($ch, array( - CURLOPT_RETURNTRANSFER => true, - CURLOPT_FAILONERROR => true - )); - if ($method == 'POST') - { - curl_setopt_array($ch, array( - CURLOPT_POST => true, - CURLOPT_POSTFIELDS => $payload - )); - } - if ($this->collectCodeCoverageInformation) - { - curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID=true'); - } - if ($this->args['DEBUG'] > 0) { - curl_setopt($ch, CURLOPT_VERBOSE, 1); - } - $page = curl_exec($ch); - curl_close($ch); - - $this->assertNotFalse($page); - $this->assertNotContains('Fatal error', $page); - $this->assertNotContains('Notice:', $page); - - return $page; - } - public function testAgeSort() { $page = $this->request('client/agesort.php'); @@ -124,7 +54,7 @@ class DemoFilesTest extends PHPUnit_Framework_TestCase public function testSimpleCall() { - $page = $this->request('client/simple_call.php'); + $page = $this->request('client/simple_call.php', 'GET', null, true); } public function testWhich() @@ -146,13 +76,13 @@ class DemoFilesTest extends PHPUnit_Framework_TestCase { $page = $this->request('server/discuss.php'); $this->assertContains('faultCode', $page); - $this->assertContains('105', $page); + $this->assertRegexp('#10(5|3)#', $page); } public function testProxyServer() { $page = $this->request('server/proxy.php'); $this->assertContains('faultCode', $page); - $this->assertContains('105', $page); + $this->assertRegexp('#10(5|3)#', $page); } }