FilterBooleanOperatorDefaultTest.php

Same filename in this branch
  1. 11.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterBooleanOperatorDefaultTest.php
Same filename in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorDefaultTest.php
  2. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterBooleanOperatorDefaultTest.php
  3. 8.9.x core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorDefaultTest.php
  4. 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterBooleanOperatorDefaultTest.php
  5. 10 core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorDefaultTest.php
  6. 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterBooleanOperatorDefaultTest.php

Namespace

Drupal\Tests\views\Kernel\Handler

File

core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorDefaultTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\views\Kernel\Handler;

use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Views;

/**
 * Tests the queryOpBoolean() with default operator.
 *
 * @group views
 * @see \Drupal\views\Plugin\views\filter\BooleanOperator
 */
class FilterBooleanOperatorDefaultTest extends ViewsKernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'system',
        'views_test_data',
    ];
    
    /**
     * {@inheritdoc}
     */
    public static $testViews = [
        'test_view',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected function viewsData() {
        $views_data = parent::viewsData();
        $views_data['views_test_data']['status']['filter']['id'] = 'boolean_default';
        return $views_data;
    }
    
    /**
     * Tests the queryOpBoolean() with default operator.
     */
    public function testFilterBooleanOperatorDefault() : void {
        $view = Views::getView('test_view');
        $view->setDisplay();
        $view->displayHandlers
            ->get('default')
            ->overrideOption('filters', [
            'status' => [
                'id' => 'status',
                'field' => 'status',
                'table' => 'views_test_data',
                'value' => 0,
            ],
        ]);
        $this->executeView($view);
        $this->assertCount(2, $view->result);
    }

}

Classes

Title Deprecated Summary
FilterBooleanOperatorDefaultTest Tests the queryOpBoolean() with default operator.

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