You are here

public function ChainResponsePolicyTest::testChainExceptionOnInvalidReturnValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php \Drupal\Tests\Core\PageCache\ChainResponsePolicyTest::testChainExceptionOnInvalidReturnValue()

Asserts that check() throws an exception if a rule returns an invalid value.

@expectedException \UnexpectedValueException @dataProvider providerChainExceptionOnInvalidReturnValue @covers ::check

File

core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php, line 84
Contains \Drupal\Tests\Core\PageCache\ChainResponsePolicyTest.

Class

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

Namespace

Drupal\Tests\Core\PageCache

Code

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