InOperator example

class InOperatorTest extends UnitTestCase {

  /** * @covers ::validate */
  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]);
  }

  /** * @return array */
  
Home | Imprint | This part of the site doesn't use cookies.