PageTest.php in Drupal 8
File
core/modules/system/tests/src/Functional/Batch/PageTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\Batch;
use Drupal\Tests\BrowserTestBase;
class PageTest extends BrowserTestBase {
public static $modules = [
'batch_test',
];
protected $defaultTheme = 'stark';
public function testBatchProgressPageTheme() {
$this->container
->get('theme_installer')
->install([
'seven',
'bartik',
]);
$this
->config('system.theme')
->set('default', 'bartik')
->set('admin', 'seven')
->save();
$admin_user = $this
->drupalCreateUser([
'view the administration theme',
]);
$this
->drupalLogin($admin_user);
$this
->drupalGet('admin/batch-test/test-theme');
$this
->assertEqual(batch_test_stack(), [
'seven',
], 'A progressive batch correctly uses the theme of the page that started the batch.');
}
public function testBatchProgressPageTitle() {
$this->maximumMetaRefreshCount = 0;
$this
->drupalGet('batch-test/test-title');
$this
->assertText('Batch Test', 'The test is in the html output.');
$this->maximumMetaRefreshCount = NULL;
$this
->drupalGet('batch-test/test-title');
$this
->assertEqual(batch_test_stack(), [
'Batch Test',
], 'The batch title is shown on the batch page.');
$this
->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
}
public function testBatchProgressMessages() {
$this->maximumMetaRefreshCount = 0;
$this
->drupalGet('batch-test/test-title');
$this
->assertRaw('<div class="progress__description">Initializing.<br /> </div>', 'Initial progress message appears correctly.');
$this
->assertNoRaw('&nbsp;', 'Initial progress message is not double escaped.');
$this->maximumMetaRefreshCount = 1;
$this
->drupalGet('batch-test/test-title');
$this
->assertRaw('<div class="progress__description">Completed 1 of 1.</div>', 'Progress message for second step appears correctly.');
}
}
Classes
Name |
Description |
PageTest |
Tests the content of the progress page. |