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