BlockTest.php in Style Switcher 3.0.x
File
tests/src/Functional/BlockTest.php
View source
<?php
namespace Drupal\Tests\styleswitcher\Functional;
use Drupal\Tests\BrowserTestBase;
class BlockTest extends BrowserTestBase {
use HelperTrait;
protected static $modules = [
'styleswitcher',
'block',
];
protected $defaultTheme = 'classy';
public function testBlockExists() {
$assert = $this
->assertSession();
$user = $this
->drupalCreateUser([
'administer blocks',
]);
$this
->drupalLogin($user);
$this
->drupalGet('admin/structure/block/add/styleswitcher_styleswitcher');
$assert
->fieldValueEquals('id', 'styleswitcher');
$label = $this
->randomString();
$edit = [
'settings[label]' => $label,
'region' => 'sidebar_first',
];
$this
->submitForm($edit, 'Save block');
$assert
->pageTextContains('The block configuration has been saved.');
$assert
->elementTextContains('css', '#blocks', $label);
}
}