BrowserTestBaseTest.php in Zircon Profile 8.0
File
core/modules/simpletest/tests/src/Functional/BrowserTestBaseTest.php
View source
<?php
namespace Drupal\Tests\simpletest\Functional;
use Drupal\simpletest\BrowserTestBase;
class BrowserTestBaseTest extends BrowserTestBase {
public static $modules = array(
'test_page_test',
'form_test',
);
public function testGoTo() {
$account = $this
->drupalCreateUser();
$this
->drupalLogin($account);
$this
->drupalGet('test-page');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('Test page text.');
}
public function testForm() {
$this
->drupalGet('form-test/object-builder');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->elementExists('css', 'form#form-test-form-test-object');
$this
->assertSession()
->fieldExists('bananas');
$edit = [
'bananas' => 'green',
];
$this
->submitForm($edit, 'Save', 'form-test-form-test-object');
$config_factory = $this->container
->get('config.factory');
$value = $config_factory
->get('form_test.object')
->get('bananas');
$this
->assertSame('green', $value);
}
}