You are here

public function ViewsModerationStateFilterTest::testNonTranslatableEntityType in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::testNonTranslatableEntityType()
  2. 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 178

Class

ViewsModerationStateFilterTest
Tests the views 'moderation_state_filter' filter plugin.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testNonTranslatableEntityType() {
  $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',
  ]);
}