class BrowserTestBaseTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/tests/src/Functional/BrowserTestBaseTest.php \Drupal\Tests\simpletest\Functional\BrowserTestBaseTest
Tests BrowserTestBase functionality.
@group simpletest
@runTestsInSeparateProcesses @preserveGlobalState disabled
Hierarchy
- class \Drupal\simpletest\BrowserTestBase extends \Drupal\simpletest\PHPUnit_Framework_TestCase uses RandomGeneratorTrait, SessionTestTrait
- class \Drupal\Tests\simpletest\Functional\BrowserTestBaseTest
Expanded class hierarchy of BrowserTestBaseTest
File
- core/
modules/ simpletest/ tests/ src/ Functional/ BrowserTestBaseTest.php, line 20 - Contains \Drupal\Tests\simpletest\Functional\BrowserTestBaseTest.
Namespace
Drupal\Tests\simpletest\FunctionalView source
class BrowserTestBaseTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array(
'test_page_test',
'form_test',
);
/**
* Tests basic page test.
*/
public function testGoTo() {
$account = $this
->drupalCreateUser();
$this
->drupalLogin($account);
// Visit a Drupal page that requires login.
$this
->drupalGet('test-page');
$this
->assertSession()
->statusCodeEquals(200);
// Test page contains some text.
$this
->assertSession()
->pageTextContains('Test page text.');
}
/**
* Tests basic form functionality.
*/
public function testForm() {
// Ensure the proper response code for a _form route.
$this
->drupalGet('form-test/object-builder');
$this
->assertSession()
->statusCodeEquals(200);
// Ensure the form and text field exist.
$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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BrowserTestBase:: |
protected | property | Class loader. | |
BrowserTestBase:: |
protected | property | The config directories used in this test. | |
BrowserTestBase:: |
protected | property | The config importer that can be used in a test. | |
BrowserTestBase:: |
protected | property | The dependency injection container used in the test. | |
BrowserTestBase:: |
protected | property | An array of custom translations suitable for drupal_rewrite_settings(). | |
BrowserTestBase:: |
protected | property | The database prefix of this test run. | |
BrowserTestBase:: |
protected | property | The DrupalKernel instance used in the test. | |
BrowserTestBase:: |
protected | property | The current user logged in using the Mink controlled browser. | |
BrowserTestBase:: |
protected | property | Mink session manager. | |
BrowserTestBase:: |
protected | property | ||
BrowserTestBase:: |
protected | property | ||
BrowserTestBase:: |
protected | property | The site directory of the original parent site. | |
BrowserTestBase:: |
protected | property | The private file directory for the test environment. | |
BrowserTestBase:: |
protected | property | The profile to install as a basis for testing. | |
BrowserTestBase:: |
protected | property | The public file directory for the test environment. | |
BrowserTestBase:: |
protected | property | The root user. | |
BrowserTestBase:: |
protected | property | The site directory of this test run. | |
BrowserTestBase:: |
protected | property | The temp file directory for the test environment. | |
BrowserTestBase:: |
protected | property | Time limit in seconds for the test. | |
BrowserTestBase:: |
protected | property | The translation file directory for the test environment. | |
BrowserTestBase:: |
public | function | Returns WebAssert object. | |
BrowserTestBase:: |
private | function | Changes the database connection to the prefixed one. | |
BrowserTestBase:: |
protected | function | Checks whether a given list of permission names is valid. | |
BrowserTestBase:: |
protected | function | Clean up the Simpletest environment. | |
BrowserTestBase:: |
protected | function | Creates a role with specified permissions. | |
BrowserTestBase:: |
protected | function | Creates a user with a given set of permissions. | |
BrowserTestBase:: |
protected | function | Retrieves a Drupal path or an absolute path. | |
BrowserTestBase:: |
protected | function | Logs in a user using the Mink controlled browser. | |
BrowserTestBase:: |
protected | function | Logs a user out of the Mink controlled browser and confirms. | |
BrowserTestBase:: |
protected | function | Returns whether a given user account is logged in. | |
BrowserTestBase:: |
public static | function | Ensures test files are deletable within file_unmanaged_delete_recursive(). | |
BrowserTestBase:: |
protected | function | Takes a path and returns an absolute path. | |
BrowserTestBase:: |
public static | function | Returns the database connection to the site running Simpletest. | |
BrowserTestBase:: |
protected | function | Gets an instance of the default Mink driver. | |
BrowserTestBase:: |
protected | function | Helper function to get the options of select field. | |
BrowserTestBase:: |
public | function | Returns Mink session. | |
BrowserTestBase:: |
protected | function | Initializes Mink sessions. | |
BrowserTestBase:: |
public | function | Installs Drupal into the Simpletest site. | |
BrowserTestBase:: |
protected | function | Returns the parameters that will be used when Simpletest installs Drupal. | |
BrowserTestBase:: |
private | function | Generates a database prefix for running tests. | |
BrowserTestBase:: |
protected | function | Prepares the current environment for running the test. | |
BrowserTestBase:: |
protected | function | Prepare for a request to testing site. | |
BrowserTestBase:: |
protected | function | Creates a mock request and sets it on the generator. | |
BrowserTestBase:: |
protected | function | Rebuilds \Drupal::getContainer(). | |
BrowserTestBase:: |
protected | function | Refreshes in-memory configuration and state information. | |
BrowserTestBase:: |
protected | function | Registers additional Mink sessions. | |
BrowserTestBase:: |
protected | function | Resets all data structures after having enabled new modules. | |
BrowserTestBase:: |
protected | function | Override to use Mink exceptions. | |
BrowserTestBase:: |
protected | function | ||
BrowserTestBase:: |
protected | function | Fills and submits a form. | |
BrowserTestBase:: |
protected | function | ||
BrowserTestBase:: |
protected | function | Rewrites the settings.php file of the test site. | |
BrowserTestBaseTest:: |
public static | property | Modules to enable. | |
BrowserTestBaseTest:: |
public | function | Tests basic form functionality. | |
BrowserTestBaseTest:: |
public | function | Tests basic page test. | |
RandomGeneratorTrait:: |
protected | property | The random generator. | |
RandomGeneratorTrait:: |
protected | function | Gets the random generator for the utility methods. | |
RandomGeneratorTrait:: |
protected | function | Generates a unique random string containing letters and numbers. | |
RandomGeneratorTrait:: |
public | function | Generates a random PHP object. | |
RandomGeneratorTrait:: |
public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
RandomGeneratorTrait:: |
public | function | Callback for random string validation. | |
SessionTestTrait:: |
protected | property | The name of the session cookie. | |
SessionTestTrait:: |
protected | function | Generates a session cookie name. | |
SessionTestTrait:: |
protected | function | Returns the session name in use on the child site. |