function FilterBooleanOperatorGroupTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorGroupTest.php \Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorGroupTest::setUp()
  2. 10 core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorGroupTest.php \Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorGroupTest::setUp()

Overrides ViewsKernelTestBase::setUp

File

core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorGroupTest.php, line 46

Class

FilterBooleanOperatorGroupTest
Tests the core <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21filter%21BooleanOperator.php/class/BooleanOperator/11.x" title="Simple filter to handle matching of boolean values." class="local">Drupal\views\Plugin\views\filter\BooleanOperator</a> handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function setUp($import_test_views = TRUE) : void {
    parent::setUp($import_test_views);
    $this->installEntitySchema('node');
    $this->installEntitySchema('user');
    $this->installSchema('node', [
        'node_access',
    ]);
    $this->installConfig([
        'node',
    ]);
    $node_type = NodeType::create([
        'type' => 'page',
        'name' => 'Page',
    ]);
    $node_type->setDisplaySubmitted(FALSE);
    $node_type->save();
    FieldStorageConfig::create([
        'entity_type' => 'node',
        'type' => 'boolean',
        'field_name' => 'field_test_boolean_field',
    ])->save();
    FieldConfig::create([
        'entity_type' => 'node',
        'bundle' => 'page',
        'field_name' => 'field_test_boolean_field',
    ])->save();
    Node::create([
        'title' => 'Checked',
        'type' => 'page',
        'field_test_boolean_field' => 1,
        'status' => TRUE,
    ])->save();
    Node::create([
        'title' => 'Un-checked',
        'type' => 'page',
        'field_test_boolean_field' => 0,
        'status' => TRUE,
    ])->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.