You are here

public function ContentListTest::testSchedulerLocalTask in Thunder 6.0.x

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/ContentListTest.php \Drupal\Tests\thunder\Functional\ContentListTest::testSchedulerLocalTask()
  2. 8.2 tests/src/Functional/ContentListTest.php \Drupal\Tests\thunder\Functional\ContentListTest::testSchedulerLocalTask()
  3. 8.3 tests/src/Functional/ContentListTest.php \Drupal\Tests\thunder\Functional\ContentListTest::testSchedulerLocalTask()
  4. 8.4 tests/src/Functional/ContentListTest.php \Drupal\Tests\thunder\Functional\ContentListTest::testSchedulerLocalTask()
  5. 6.2.x tests/src/Functional/ContentListTest.php \Drupal\Tests\thunder\Functional\ContentListTest::testSchedulerLocalTask()
  6. 6.1.x tests/src/Functional/ContentListTest.php \Drupal\Tests\thunder\Functional\ContentListTest::testSchedulerLocalTask()

Tests scheduler tab is in local tasks.

File

tests/src/Functional/ContentListTest.php, line 22

Class

ContentListTest
Test the Thunder content list view.

Namespace

Drupal\Tests\thunder\Functional

Code

public function testSchedulerLocalTask() {
  $this
    ->logWithRole('administrator');
  $this
    ->drupalGet('admin/content');
  $primaryMenuBlockSelector = '#block-thunder-admin-primary-local-tasks > nav > nav > ul';
  $secondaryMenuBlockSelector = '#block-thunder-admin-secondary-local-tasks > nav > nav > ul';
  $assert_session = $this
    ->assertSession();
  $assert_session
    ->elementTextNotContains('css', $primaryMenuBlockSelector, 'Scheduled');
  $assert_session
    ->elementTextContains('css', $secondaryMenuBlockSelector, 'Overview');
  $assert_session
    ->elementTextContains('css', $secondaryMenuBlockSelector, 'Scheduled content');
  $assert_session
    ->elementTextContains('css', $secondaryMenuBlockSelector, 'Locked content');
  $this
    ->drupalPostForm('admin/config/thunder_article/configuration', [
    'move_scheduler_local_task' => 0,
  ], 'Save configuration');
  $this
    ->drupalGet('admin/content');
  $assert_session
    ->elementTextNotContains('css', $secondaryMenuBlockSelector, 'Scheduled content');
  $assert_session
    ->elementTextContains('css', $primaryMenuBlockSelector, 'Scheduled');
  $assert_session
    ->elementTextContains('css', $secondaryMenuBlockSelector, 'Locked content');
  $this
    ->drupalPostForm('admin/config/thunder_article/configuration', [
    'move_scheduler_local_task' => 1,
  ], 'Save configuration');
  $this
    ->drupalGet('admin/content');
  $assert_session
    ->elementTextNotContains('css', $primaryMenuBlockSelector, 'Scheduled');
  $assert_session
    ->elementTextContains('css', $secondaryMenuBlockSelector, 'Scheduled content');
  $this
    ->drupalPostForm('admin/config/thunder_article/configuration', [
    'move_scheduler_local_task' => 0,
  ], 'Save configuration');
  $this
    ->drupalGet('admin/content');
  $assert_session
    ->elementTextContains('css', $primaryMenuBlockSelector, 'Scheduled');
  $assert_session
    ->elementTextNotContains('css', $secondaryMenuBlockSelector, 'Scheduled content');

  // Uninstall the scheduler and the links should be gone.
  $this->container
    ->get('module_installer')
    ->uninstall([
    'scheduler',
  ]);
  $this
    ->drupalGet('admin/content');
  $assert_session
    ->elementTextNotContains('css', $primaryMenuBlockSelector, 'Scheduled');
  $assert_session
    ->elementTextNotContains('css', $secondaryMenuBlockSelector, 'Scheduled content');
}