UnauthorizedHttpExceptionTest.php 696 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace Symfony\Component\HttpKernel\Tests\Exception;
  3. use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
  4. class UnauthorizedHttpExceptionTest extends HttpExceptionTest
  5. {
  6. public function testHeadersDefault()
  7. {
  8. $exception = new UnauthorizedHttpException('Challenge');
  9. $this->assertSame(['WWW-Authenticate' => 'Challenge'], $exception->getHeaders());
  10. }
  11. /**
  12. * @dataProvider headerDataProvider
  13. */
  14. public function testHeadersSetter($headers)
  15. {
  16. $exception = new UnauthorizedHttpException('Challenge');
  17. $exception->setHeaders($headers);
  18. $this->assertSame($headers, $exception->getHeaders());
  19. }
  20. }