function InOperatorTest::testValidate
Same name and namespace in other branches
- 8.9.x core/modules/views/tests/src/Unit/Plugin/filter/InOperatorTest.php \Drupal\Tests\views\Unit\Plugin\filter\InOperatorTest::testValidate()
- 10 core/modules/views/tests/src/Unit/Plugin/filter/InOperatorTest.php \Drupal\Tests\views\Unit\Plugin\filter\InOperatorTest::testValidate()
- 11.x core/modules/views/tests/src/Unit/Plugin/filter/InOperatorTest.php \Drupal\Tests\views\Unit\Plugin\filter\InOperatorTest::testValidate()
@covers ::validate
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ filter/ InOperatorTest.php, line 17
Class
- InOperatorTest
- @coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21filter%21InOperator.php/class/InOperator/9" title="Simple filter to handle matching of multiple options selectable via checkboxes." class="local">\Drupal\views\Plugin\views\filter\InOperator</a> @group views
Namespace
Drupal\Tests\views\Unit\Plugin\filterCode
public function testValidate() {
$definition = [
'title' => 'Is InOperator Test',
'group' => 'Test',
'options callback' => '\\Drupal\\Tests\\views\\Unit\\Plugin\\filter\\InOperatorTest::validate_options_callback',
];
$filter = new InOperator([], 'in_operator', $definition);
$filter->value = 'string';
$filter->operator = 'in';
$translation_stub = $this->getStringTranslationStub();
$filter->setStringTranslation($translation_stub);
$errors = $filter->validate();
$this->assertSame('The value 'string' is not an array for in on filter: ' . $filter->adminLabel(TRUE), (string) $errors[0]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.