Skip to content

Commit

Permalink
[Maintenace] Test existence of new cache headers
Browse files Browse the repository at this point in the history
  • Loading branch information
lchrusciel authored and GSadee committed Mar 7, 2022
1 parent 4b6a77a commit 691b700
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
@@ -0,0 +1,43 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Tests\EventListener;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

final class AdminSectionCacheControlSubscriberTest extends WebTestCase
{
/**
* @test
*/
public function it_returns_proper_cache_headers_for_admin_endpoints(): void
{
$client = static::createClient();

$client->request('GET', '/admin/');

$this->assertResponseHeaderSame('Cache-Control', 'max-age=0, must-revalidate, no-cache, no-store, private');
}

/**
* @test
*/
public function it_returns_normal_headers_otherwise(): void
{
$client = static::createClient();

$client->request('GET', '/en_US/');

$this->assertResponseHeaderSame('Cache-Control', 'max-age=0, must-revalidate, private');
}
}
@@ -0,0 +1,43 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Tests\EventListener;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

final class AdminSectionCacheControlSubscriberTest extends WebTestCase
{
/**
* @test
*/
public function it_returns_proper_cache_headers_for_customer_account_endpoints(): void
{
$client = static::createClient();

$client->request('GET', '/en_US/account/');

$this->assertResponseHeaderSame('Cache-Control', 'max-age=0, must-revalidate, no-cache, no-store, private');
}

/**
* @test
*/
public function it_returns_normal_headers_otherwise(): void
{
$client = static::createClient();

$client->request('GET', '/en_US/');

$this->assertResponseHeaderSame('Cache-Control', 'max-age=0, must-revalidate, private');
}
}

0 comments on commit 691b700

Please sign in to comment.