22 private static $serverPid;
34 if (!(defined(
'TRAVIS') && TRAVIS ===
true)) {
35 self::markTestSkipped(
'Travis environment test');
41 'cd %s && php -S %s -t ./pub/ ./phpserver/router.php >/dev/null 2>&1 & echo $!',
45 exec($command, $return);
46 static::$serverPid = (int) $return[0];
49 private function getUrl(
$url)
51 return sprintf(
'http://%s/%s', self::BASE_URL, ltrim(
$url,
'/'));
56 $this->httpClient = new \Zend\Http\Client(
null, [
'timeout' => 10]);
61 $this->assertTrue(static::$serverPid > 0);
66 $this->httpClient->setUri($this->getUrl(
'/'));
68 $this->assertFalse(
$response->isClientError());
73 $this->httpClient->setUri($this->getUrl(
'/errors/default/css/styles.css'));
76 $this->assertFalse(
$response->isClientError());
77 $this->assertStringStartsWith(
'text/css',
$response->getHeaders()->get(
'Content-Type')->getMediaType());
82 $this->httpClient->setUri($this->getUrl(
'/errors/default/images/logo.gif'));
85 $this->assertFalse(
$response->isClientError());
86 $this->assertStringStartsWith(
'image/gif',
$response->getHeaders()->get(
'Content-Type')->getMediaType());
91 posix_kill(static::$serverPid, SIGKILL);
exec($command, array &$output=null, &$return_var=null)
defined('TESTS_BP')||define('TESTS_BP' __DIR__
static tearDownAfterClass()
static setUpBeforeClass()