1 batch.test BatchPageTestCase::testBatchProgressPageTheme()

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

File

core/modules/simpletest/tests/batch.test, line 286
Tests for the Batch API.

Class

BatchPageTestCase
Tests for the Batch API Progress page.

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.
  config_set('system.core', 'theme_default', 'bartik');
  config_set('system.core', 'admin_theme', 'seven');
  // Log in as an administrator who can see the administrative theme.
  $admin_user = $this->backdropCreateUser(array('view the administration theme'));
  $this->backdropLogin($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->backdropGet('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'), t('A progressive batch correctly uses the theme of the page that started the batch.'));
}