function WorkspaceViewsIntegrationTest::countTermViewResults

Counts the rows of a term view filtered on the description column.

Parameters

string $value: The description value to filter for.

Return value

int The number of rows the view returned.

File

core/modules/workspaces/tests/src/Kernel/WorkspaceViewsIntegrationTest.php, line 302

Class

WorkspaceViewsIntegrationTest
Tests the views integration for workspaces.

Namespace

Drupal\Tests\workspaces\Kernel

Code

protected function countTermViewResults(string $value) : int {
  $view = View::create([
    'id' => 'test_taxonomy_term',
    'base_table' => 'taxonomy_term_field_data',
    'base_field' => 'tid',
  ]);
  $executable = Views::executableFactory()->get($view);
  $executable->setDisplay('default');
  $executable->addHandler('default', 'filter', 'taxonomy_term_field_data', 'description__value', [
    'operator' => '=',
    'value' => $value,
  ]);
  $executable->execute();
  return count($executable->result);
}

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