/dev/null 2>&1 & echo $!', $baseDir, static::BASE_URL ); exec($command, $return); static::$serverPid = (int) $return[0]; } private function getUrl($url) { return sprintf('http://%s/%s', self::BASE_URL, ltrim($url, '/')); } public function setUp() { $this->httpClient = new \Zend\Http\Client(null, ['timeout' => 10]); } public function testServerHasPid() { $this->assertTrue(static::$serverPid > 0); } public function testServerResponds() { $this->httpClient->setUri($this->getUrl('/')); $response = $this->httpClient->send(); $this->assertFalse($response->isClientError()); } public function testStaticCssFile() { $this->httpClient->setUri($this->getUrl('/errors/default/css/styles.css')); $response = $this->httpClient->send(); $this->assertFalse($response->isClientError()); $this->assertStringStartsWith('text/css', $response->getHeaders()->get('Content-Type')->getMediaType()); } public function testStaticImageFile() { $this->httpClient->setUri($this->getUrl('/errors/default/images/logo.gif')); $response = $this->httpClient->send(); $this->assertFalse($response->isClientError()); $this->assertStringStartsWith('image/gif', $response->getHeaders()->get('Content-Type')->getMediaType()); } public static function tearDownAfterClass() { posix_kill(static::$serverPid, SIGKILL); } }