function WorkspaceViewsIntegrationTest::testViewsQueryAlterMultiColumnField
Tests the views query alter for a field stored in more than one column.
File
-
core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceViewsIntegrationTest.php, line 269
Class
- WorkspaceViewsIntegrationTest
- Tests the views integration for workspaces.
Namespace
Drupal\Tests\workspaces\KernelCode
public function testViewsQueryAlterMultiColumnField() : void {
Vocabulary::create([
'vid' => 'tags',
'name' => 'Tags',
])->save();
$term = Term::create([
'vid' => 'tags',
'name' => 'Test term',
'description' => [
'value' => 'live text',
'format' => 'plain_text',
],
]);
$term->save();
Workspace::create([
'id' => 'stage',
'label' => 'Stage',
])->save();
$this->assertSame(1, $this->countTermViewResults('live text'));
$this->assertSame(0, $this->countTermViewResults('stage text'));
$this->switchToWorkspace('stage');
$term->set('description', [
'value' => 'stage text',
'format' => 'plain_text',
]);
$term->save();
// Views names the column 'description__value', not 'description', so the
// filter is only redirected when the column name is matched.
$this->assertSame(1, $this->countTermViewResults('stage text'));
$this->assertSame(0, $this->countTermViewResults('live text'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.