public function EntityTest::testValidateArgumentMultiple in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::testValidateArgumentMultiple()
Tests the validate argument method with multiple argument splitting.
File
- core/
modules/ views/ tests/ src/ Unit/ Plugin/ argument_validator/ EntityTest.php, line 238
Class
- EntityTest
- @coversDefaultClass \Drupal\views\Plugin\views\argument_validator\Entity @group views
Namespace
Drupal\Tests\views\Unit\Plugin\argument_validatorCode
public function testValidateArgumentMultiple() {
$options = [];
$options['access'] = TRUE;
$options['bundles'] = [];
$options['operation'] = 'test_op';
$options['multiple'] = TRUE;
$this->argumentValidator
->init($this->executable, $this->display, $options);
$this
->assertTrue($this->argumentValidator
->validateArgument('1'));
$this
->assertFalse($this->argumentValidator
->validateArgument('2'));
$this
->assertFalse($this->argumentValidator
->validateArgument('1,2'));
$this
->assertFalse($this->argumentValidator
->validateArgument('1+2'));
$options = [];
$options['access'] = TRUE;
$options['bundles'] = [];
$options['operation'] = 'test_op_3';
$options['multiple'] = TRUE;
$this->argumentValidator
->init($this->executable, $this->display, $options);
$this
->assertTrue($this->argumentValidator
->validateArgument('1,2'));
$this
->assertTrue($this->argumentValidator
->validateArgument('1+2'));
}