You are here

public function ModerationDashboardComponentsTest::testModerationActivityChartWithData in Moderation Dashboard 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/ModerationDashboardComponentsTest.php \Drupal\Tests\moderation_dashboard\Functional\ModerationDashboardComponentsTest::testModerationActivityChartWithData()

Tests moderation activity chart with some data.

File

tests/src/Functional/ModerationDashboardComponentsTest.php, line 112

Class

ModerationDashboardComponentsTest
Tests moderation dashboard components.

Namespace

Drupal\Tests\moderation_dashboard\Functional

Code

public function testModerationActivityChartWithData() {
  $this
    ->drupalCreateNode([
    'title' => 'Draft node',
    'moderation_state' => 'draft',
  ]);
  $this
    ->drupalCreateNode([
    'title' => 'Published node',
    'moderation_state' => 'published',
  ]);
  $this
    ->drupalGet('/user/' . $this->user
    ->id() . '/moderation-dashboard');
  $drupal_js_settings = $this
    ->getDrupalSettings();
  $this
    ->assertTrue(count($drupal_js_settings['moderation_dashboard_activity']['datasets']) === 2);
}