function NoneTest::testValidateNone
Same name and namespace in other branches
- main core/modules/views/tests/src/Unit/Plugin/argument_validator/NoneTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\NoneTest::testValidateNone()
Tests validation of the None argument.
Attributes
#[TestWith([
TRUE,
3,
[
'numeric' => TRUE,
],
[],
], 'numeric value')]
#[TestWith([
FALSE,
'string',
[
'numeric' => TRUE,
],
[],
], 'nonnumeric value')]
#[TestWith([
TRUE,
'string',
[
'numeric' => TRUE,
],
[
'break_phrase' => TRUE,
],
], 'break phrase bypass')]
#[TestWith([
TRUE,
'string',
[
'numeric' => TRUE,
],
[
'break_phrase' => FALSE,
],
], 'false break phrase bypass')]
#[TestWith([
FALSE,
NULL,
[],
[],
], 'null argument')]
#[TestWith([
FALSE,
'',
[],
[],
], 'empty argument')]
#[TestWith([
TRUE,
NULL,
[],
[
'must_not_be' => TRUE,
],
], 'must not be with null')]
#[TestWith([
FALSE,
'',
[],
[
'must_not_be' => TRUE,
],
], 'must not be with empty string')]
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ argument_validator/ NoneTest.php, line 24
Class
- NoneTest
- Tests the None argument validator.
Namespace
Drupal\Tests\views\Unit\Plugin\argument_validatorCode
public function testValidateNone(bool $expected, mixed $argument, array $definition, array $options) : void {
$argument_handler = new Standard([], 'standard', []);
$argument_handler->definition = $definition;
$argument_handler->options = $options;
$validator = new None([], 'none_test', []);
$validator->setArgument($argument_handler);
$this->assertSame($expected, $validator->validateArgument($argument));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.