Не удалось утверждать, что статус HTTP равен 200 не 500

У меня возникают проблемы с запуском phpunit-тестов в нашем приложении symfony.

Я использую следующий код утверждения:

namespace Main\MyBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DefaultControllerTest extends WebTestCase { public function testIndex() { $client = static::createClient(); $crawler = $client->request('GET', '/'); var_dump( $client->getInternalResponse()); //checking home page availability $this->assertEquals(200, $client->getResponse()->getStatusCode()); } } 

Однако я все время получаю отказ, как вы можете видеть из приведенного ниже результата:

  mcp@mcp-buildbox:/var/www/my.app.com$ phpunit -c app src/Main/MyBundle PHPUnit 3.6.10 by Sebastian Bergmann. Configuration read from /var/www/my.app.com/app/phpunit.xml.dist Fclass Symfony\Component\BrowserKit\Response#182 (3) { protected $content => string(138299) "<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>\n <meta name="robots" content="noindex,nofollow" />\n <title> Undefined index: SERVER_PORT (500 Internal Server Error)\n</title>\n <link href="/bundles/framework/css/structure.css" rel="stylesheet" type="text/css" media="all" />\n <link href="/bundles/framework/css/body.css" rel="stylesheet" type="text/css" media="all" />\n <link href="/bundles/framework"... protected $status => int(500) protected $headers => array(3) { 'cache-control' => array(1) { [0] => string(8) "no-cache" } 'date' => array(1) { [0] => string(29) "Thu, 08 May 2014 15:32:16 GMT" } 'content-type' => array(1) { [0] => string(24) "text/html; charset=UTF-8" } } } Time: 0 seconds, Memory: 22.25Mb There was 1 failure: 1) Main\MyBundle\Tests\Controller\DefaultControllerTest::testIndex Failed asserting that 500 matches expected 200. /var/www/my.app.com/src/Main/MyBundle/Tests/Controller/DefaultControllerTest.php:25 FAILURES! Tests: 1, Assertions: 1, Failures: 1. 

Вот мои настройки в файле config.yml:

 framework: #esi: ~ translator: { fallback: %locale% } secret: %secret% router: resource: "%kernel.root_dir%/config/routing.yml" strict_requirements: ~ http_port: 80 https_port: 443 form: ~ csrf_protection: ~ validation: { enable_annotations: true } templating: engines: ['twig'] #assets_version: SomeVersionScheme default_locale: "%locale%" trusted_proxies: "%trusted_proxies%" session: ~ fragments: ~ trusted_hosts: ~ 

Также обратите внимание, что когда я это делаю:

 curl -I http://my.app.com 

Я получил:

 HTTP/1.1 200 OK 

Я также использую PHP 5.4.9 и на машине ubuntu. Может кто-нибудь помочь? Я посмотрел на стек и увидел, что у кого-то еще была идентичная проблема, но разрешение мне не понятно, и ответ на самом деле не является решением:

Сбой при утверждении кода состояния HTTP: 200 не 500