You are here

public function ChainResponsePolicyTest::testNullRuleChain in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php \Drupal\Tests\Core\PageCache\ChainResponsePolicyTest::testNullRuleChain()
  2. 9 core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php \Drupal\Tests\Core\PageCache\ChainResponsePolicyTest::testNullRuleChain()

Asserts that check() returns NULL if a rule returns NULL.

@covers ::check

File

core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php, line 59

Class

ChainResponsePolicyTest
@coversDefaultClass \Drupal\Core\PageCache\ChainResponsePolicy @group PageCache

Namespace

Drupal\Tests\Core\PageCache

Code

public function testNullRuleChain() {
  $rule = $this
    ->createMock('Drupal\\Core\\PageCache\\ResponsePolicyInterface');
  $rule
    ->expects($this
    ->once())
    ->method('check')
    ->with($this->response, $this->request)
    ->will($this
    ->returnValue(NULL));
  $this->policy
    ->addPolicy($rule);
  $result = $this->policy
    ->check($this->response, $this->request);
  $this
    ->assertSame(NULL, $result);
}