"Fossies" - the Fresh Open Source Software Archive

Member "contao-4.4.48/core-bundle/tests/Exception/AjaxRedirectResponseExceptionTest.php" (2 Apr 2020, 930 Bytes) of package /linux/www/contao-4.4.48.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 
    3 /*
    4  * This file is part of Contao.
    5  *
    6  * (c) Leo Feyer
    7  *
    8  * @license LGPL-3.0-or-later
    9  */
   10 
   11 namespace Contao\CoreBundle\Tests\Exception;
   12 
   13 use Contao\CoreBundle\Exception\AjaxRedirectResponseException;
   14 use PHPUnit\Framework\TestCase;
   15 
   16 /**
   17  * Tests the AjaxRedirectResponseException class.
   18  *
   19  * @author Christian Schiffler <https://github.com/discordier>
   20  */
   21 class AjaxRedirectResponseExceptionTest extends TestCase
   22 {
   23     /**
   24      * Tests the getResponse() method.
   25      */
   26     public function testSetsTheResponseStatusCodeAndAjaxLocation()
   27     {
   28         $exception = new AjaxRedirectResponseException('http://example.org');
   29 
   30         $response = $exception->getResponse();
   31 
   32         $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
   33         $this->assertSame(302, $response->getStatusCode());
   34         $this->assertSame('http://example.org', $response->headers->get('X-Ajax-Location'));
   35     }
   36 }