public function ChainResponsePolicyTest::testChainExceptionOnInvalidReturnValue in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php \Drupal\Tests\Core\PageCache\ChainResponsePolicyTest::testChainExceptionOnInvalidReturnValue()
- 10 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.
@dataProvider providerChainExceptionOnInvalidReturnValue @covers ::check
File
- core/
tests/ Drupal/ Tests/ Core/ PageCache/ ChainResponsePolicyTest.php, line 78
Class
- ChainResponsePolicyTest
- @coversDefaultClass \Drupal\Core\PageCache\ChainResponsePolicy @group PageCache
Namespace
Drupal\Tests\Core\PageCacheCode
public function testChainExceptionOnInvalidReturnValue($return_value) {
$rule = $this
->createMock('Drupal\\Core\\PageCache\\ResponsePolicyInterface');
$rule
->expects($this
->once())
->method('check')
->with($this->response, $this->request)
->will($this
->returnValue($return_value));
$this->policy
->addPolicy($rule);
$this
->expectException(\UnexpectedValueException::class);
$this->policy
->check($this->response, $this->request);
}