function ViewsModerationStateFilterTest::testNonTranslatableEntityType

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::testNonTranslatableEntityType()
  2. 8.9.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::testNonTranslatableEntityType()
  3. 10 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::testNonTranslatableEntityType()

Tests the moderation filter with a non-translatable entity type.

File

core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php, line 183

Class

ViewsModerationStateFilterTest
Tests the views 'moderation_state_filter' filter plugin.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testNonTranslatableEntityType() : void {
  $workflow = Workflow::load('editorial');
  $workflow->getTypePlugin()
    ->addEntityTypeAndBundle('entity_test_no_bundle', 'entity_test_no_bundle');
  $workflow->save();
  $test_entity = EntityTestNoBundle::create([
    'moderation_state' => 'draft',
  ]);
  $test_entity->save();
  $view = Views::getView('test_content_moderation_state_filter_entity_test');
  $view->setExposedInput([
    'moderation_state' => 'editorial-draft',
  ]);
  $view->execute();
  $this->assertIdenticalResultset($view, [
    [
      'id' => $test_entity->id(),
    ],
  ], [
    'id' => 'id',
  ]);
}

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