function DenyPrivateImageStyleDownloadTest::testPrivateImageStyleDownloadPolicy

Same name and namespace in other branches
  1. 9 core/modules/image/tests/src/Unit/PageCache/DenyPrivateImageStyleDownloadTest.php \Drupal\Tests\image\Unit\PageCache\DenyPrivateImageStyleDownloadTest::testPrivateImageStyleDownloadPolicy()
  2. 10 core/modules/image/tests/src/Unit/PageCache/DenyPrivateImageStyleDownloadTest.php \Drupal\Tests\image\Unit\PageCache\DenyPrivateImageStyleDownloadTest::testPrivateImageStyleDownloadPolicy()
  3. 11.x core/modules/image/tests/src/Unit/PageCache/DenyPrivateImageStyleDownloadTest.php \Drupal\Tests\image\Unit\PageCache\DenyPrivateImageStyleDownloadTest::testPrivateImageStyleDownloadPolicy()

Asserts that caching is denied on the private image style download route.

@dataProvider providerPrivateImageStyleDownloadPolicy @covers ::check

File

core/modules/image/tests/src/Unit/PageCache/DenyPrivateImageStyleDownloadTest.php, line 58

Class

DenyPrivateImageStyleDownloadTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21image%21src%21PageCache%21DenyPrivateImageStyleDownload.php/class/DenyPrivateImageStyleDownload/8.9.x" title="Cache policy for image preview page." class="local">\Drupal\image\PageCache\DenyPrivateImageStyleDownload</a> @group image

Namespace

Drupal\Tests\image\Unit\PageCache

Code

public function testPrivateImageStyleDownloadPolicy($expected_result, $route_name) {
    $this->routeMatch
        ->expects($this->once())
        ->method('getRouteName')
        ->will($this->returnValue($route_name));
    $actual_result = $this->policy
        ->check($this->response, $this->request);
    $this->assertSame($expected_result, $actual_result);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.