public function RequestParamConditionTest::provideEvaluate in Condition Query 8
Provides data for static::testEvaluate().
Return value
array Array of data for each test case.
File
- tests/
src/ Kernel/ RequestParamConditionTest.php, line 84
Class
- RequestParamConditionTest
- Tests that the Request Param Condition is working properly.
Namespace
Drupal\Tests\condition_query\KernelCode
public function provideEvaluate() : array {
return [
'wrong query parameter' => [
'request_path' => '/my/page?broken=yes',
'config' => [
'request_param' => "test=yes",
],
'expected' => FALSE,
],
'right parameter, wrong value' => [
'request_path' => '/my/page?test=no',
'config' => [
'request_param' => "test=yes",
],
'expected' => FALSE,
],
'right parameter, right value' => [
'request_path' => '/my/page?test=yes',
'config' => [
'request_param' => "test=yes",
],
'expected' => TRUE,
],
'two parameters, both wrong' => [
'request_path' => '/my/page?test=no&foo=no',
'config' => [
'request_param' => "test=yes\r\nfoo=yes",
],
'expected' => FALSE,
],
'two parameters, one wrong, one right' => [
'request_path' => '/my/page?test=no&foo=yes',
'config' => [
'request_param' => "test=yes\r\nfoo=yes",
],
'expected' => TRUE,
],
'parameter without a value, present in request' => [
'request_path' => '/my/page?empty',
'config' => [
'request_param' => "test=yes\r\nempty",
],
'expected' => TRUE,
],
'parameter without a value, missing from request' => [
'request_path' => '/my/page',
'config' => [
'request_param' => "test=yes\r\nempty",
],
'expected' => FALSE,
],
];
}