You are here

function PageTest::testBatchProgressPageTheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Batch/PageTest.php \Drupal\system\Tests\Batch\PageTest::testBatchProgressPageTheme()

Tests that the batch API progress page uses the correct theme.

File

core/modules/system/src/Tests/Batch/PageTest.php, line 29
Contains \Drupal\system\Tests\Batch\PageTest.

Class

PageTest
Tests the content of the progress page.

Namespace

Drupal\system\Tests\Batch

Code

function testBatchProgressPageTheme() {

  // Make sure that the page which starts the batch (an administrative page)
  // is using a different theme than would normally be used by the batch API.
  $this->container
    ->get('theme_handler')
    ->install(array(
    'seven',
    'bartik',
  ));
  $this
    ->config('system.theme')
    ->set('default', 'bartik')
    ->set('admin', 'seven')
    ->save();

  // Log in as an administrator who can see the administrative theme.
  $admin_user = $this
    ->drupalCreateUser(array(
    'view the administration theme',
  ));
  $this
    ->drupalLogin($admin_user);

  // Visit an administrative page that runs a test batch, and check that the
  // theme that was used during batch execution (which the batch callback
  // function saved as a variable) matches the theme used on the
  // administrative page.
  $this
    ->drupalGet('admin/batch-test/test-theme');

  // The stack should contain the name of the theme used on the progress
  // page.
  $this
    ->assertEqual(batch_test_stack(), array(
    'seven',
  ), 'A progressive batch correctly uses the theme of the page that started the batch.');
}