3 namespace Symfony\Component\HttpKernel\Tests\Exception;
5 use PHPUnit\Framework\TestCase;
6 use Symfony\Component\HttpKernel\Exception\HttpException;
8 class HttpExceptionTest extends TestCase
10 public function headerDataProvider()
13 array(array('X-Test' => 'Test')),
14 array(array('X-Test' => 1)),
17 array('X-Test' => 'Test'),
18 array('X-Test-2' => 'Test-2'),
24 public function testHeadersDefault()
26 $exception = $this->createException();
27 $this->assertSame(array(), $exception->getHeaders());
31 * @dataProvider headerDataProvider
33 public function testHeadersConstructor($headers)
35 $exception = new HttpException(200, null, null, $headers);
36 $this->assertSame($headers, $exception->getHeaders());
40 * @dataProvider headerDataProvider
42 public function testHeadersSetter($headers)
44 $exception = $this->createException();
45 $exception->setHeaders($headers);
46 $this->assertSame($headers, $exception->getHeaders());
49 protected function createException()
51 return new HttpException(200);