b64773551eb31c865c717a695bb9ca8c424f850b
[yaffs-website] / vendor / symfony / http-kernel / Tests / Exception / HttpExceptionTest.php
1 <?php
2
3 namespace Symfony\Component\HttpKernel\Tests\Exception;
4
5 use PHPUnit\Framework\TestCase;
6 use Symfony\Component\HttpKernel\Exception\HttpException;
7
8 class HttpExceptionTest extends TestCase
9 {
10     public function headerDataProvider()
11     {
12         return array(
13             array(array('X-Test' => 'Test')),
14             array(array('X-Test' => 1)),
15             array(
16                 array(
17                     array('X-Test' => 'Test'),
18                     array('X-Test-2' => 'Test-2'),
19                 ),
20             ),
21         );
22     }
23
24     public function testHeadersDefault()
25     {
26         $exception = $this->createException();
27         $this->assertSame(array(), $exception->getHeaders());
28     }
29
30     /**
31      * @dataProvider headerDataProvider
32      */
33     public function testHeadersConstructor($headers)
34     {
35         $exception = new HttpException(200, null, null, $headers);
36         $this->assertSame($headers, $exception->getHeaders());
37     }
38
39     /**
40      * @dataProvider headerDataProvider
41      */
42     public function testHeadersSetter($headers)
43     {
44         $exception = $this->createException();
45         $exception->setHeaders($headers);
46         $this->assertSame($headers, $exception->getHeaders());
47     }
48
49     protected function createException()
50     {
51         return new HttpException(200);
52     }
53 }