function DenyNodePreviewTest::testPrivateImageStyleDownloadPolicy

Same name in other branches
  1. 9 core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php \Drupal\Tests\node\Unit\PageCache\DenyNodePreviewTest::testPrivateImageStyleDownloadPolicy()
  2. 8.9.x core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php \Drupal\Tests\node\Unit\PageCache\DenyNodePreviewTest::testPrivateImageStyleDownloadPolicy()
  3. 10 core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php \Drupal\Tests\node\Unit\PageCache\DenyNodePreviewTest::testPrivateImageStyleDownloadPolicy()

Asserts that caching is denied on the node preview route.

@dataProvider providerPrivateImageStyleDownloadPolicy @covers ::check

File

core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php, line 65

Class

DenyNodePreviewTest
@coversDefaultClass \Drupal\node\PageCache\DenyNodePreview @group node

Namespace

Drupal\Tests\node\Unit\PageCache

Code

public function testPrivateImageStyleDownloadPolicy($expected_result, $route_name) : void {
    $this->routeMatch
        ->expects($this->once())
        ->method('getRouteName')
        ->willReturn($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.