Namespace
Drupal\Tests\form_api_example\Functional
File
-
modules/form_api_example/tests/src/Functional/SimpleFormBlockTest.php
View source
<?php
namespace Drupal\Tests\form_api_example\Functional;
use Drupal\Tests\BrowserTestBase;
class SimpleFormBlockTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'block',
'form_api_example',
];
public function testSimpleFormBlock() {
$assert = $this->assertSession();
$web_user = $this->drupalCreateUser([
'administer blocks',
]);
$this->drupalLogin($web_user);
$theme_name = $this->config('system.theme')
->get('default');
$label = 'SimpleFormBlock-' . $this->randomString();
$settings = [
'label' => $label,
'id' => 'form_api_example_simple_form_block',
'theme' => $theme_name,
];
$this->drupalPlaceBlock('form_api_example_simple_form_block', $settings);
$this->drupalGet('');
$assert->pageTextContains($label);
$assert->fieldExists('title');
$edit = [];
$edit['title'] = 'SimpleFormBlock title example';
$this->submitForm($edit, t('Submit'));
$assert->pageTextContains('You specified a title of SimpleFormBlock title example');
}
}
Classes
| Title |
Deprecated |
Summary |
| SimpleFormBlockTest |
|
Tests \Drupal\form_api_example\Plugin\Block\SimpleFormBlock. |