1. 8.3.x core/modules/simpletest/src/BrowserTestBase.php BrowserTestBase
  2. 8.3.x core/tests/Drupal/Tests/BrowserTestBase.php BrowserTestBase
  3. 8.0.x core/modules/simpletest/src/BrowserTestBase.php BrowserTestBase
  4. 8.1.x core/tests/Drupal/Tests/BrowserTestBase.php BrowserTestBase
  5. 8.1.x core/modules/simpletest/src/BrowserTestBase.php BrowserTestBase
  6. 8.2.x core/modules/simpletest/src/BrowserTestBase.php BrowserTestBase
  7. 8.2.x core/tests/Drupal/Tests/BrowserTestBase.php BrowserTestBase
  8. 8.4.x core/tests/Drupal/Tests/BrowserTestBase.php BrowserTestBase
  9. 8.4.x core/modules/simpletest/src/BrowserTestBase.php BrowserTestBase

Provides a test case for functional Drupal tests.

Tests extending BrowserTestBase must exist in the Drupal\Tests\yourmodule\Functional namespace and live in the modules/yourmodule/tests/src/Functional directory.

Hierarchy

Expanded class hierarchy of BrowserTestBase

Deprecated

in Drupal 8.1.x, will be removed before Drupal 9.0. Use Drupal\Tests\BrowserTestBase instead.

See also

\Drupal\simpletest\WebTestBase

\Drupal\Tests\BrowserTestBase

Related topics

File

core/modules/simpletest/src/BrowserTestBase.php, line 22

Namespace

Drupal\simpletest
View source
abstract class BrowserTestBase extends BaseBrowserTestBase {
}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
AssertHelperTrait::castSafeStrings protected static function Casts MarkupInterface objects into strings.
AssertLegacyTrait::assert Deprecated protected function
AssertLegacyTrait::assertCacheTag Deprecated protected function Asserts whether an expected cache tag was present in the last response.
AssertLegacyTrait::assertElementNotPresent Deprecated protected function Asserts that the element with the given CSS selector is not present.
AssertLegacyTrait::assertElementPresent Deprecated protected function Asserts that the element with the given CSS selector is present.
AssertLegacyTrait::assertEqual Deprecated protected function
AssertLegacyTrait::assertEscaped Deprecated protected function Passes if the raw text IS found escaped on the loaded page, fail otherwise.
AssertLegacyTrait::assertFalse public static function
AssertLegacyTrait::assertField Deprecated protected function Asserts that a field exists with the given name or ID.
AssertLegacyTrait::assertFieldById Deprecated protected function Asserts that a field exists with the given ID and value.
AssertLegacyTrait::assertFieldByName Deprecated protected function Asserts that a field exists with the given name and value.
AssertLegacyTrait::assertFieldChecked Deprecated protected function Asserts that a checkbox field in the current page is checked.
AssertLegacyTrait::assertIdentical Deprecated protected function
AssertLegacyTrait::assertIdenticalObject Deprecated protected function
AssertLegacyTrait::assertLink Deprecated protected function Passes if a link with the specified label is found.
AssertLegacyTrait::assertLinkByHref Deprecated protected function Passes if a link containing a given href (part) is found.
AssertLegacyTrait::assertNoEscaped Deprecated protected function Passes if the raw text is not found escaped on the loaded page.
AssertLegacyTrait::assertNoField Deprecated protected function Asserts that a field exists with the given name or ID does NOT exist.
AssertLegacyTrait::assertNoFieldById Deprecated protected function Asserts that a field does not exist with the given ID and value.
AssertLegacyTrait::assertNoFieldByName Deprecated protected function Asserts that a field exists with the given name and value.
AssertLegacyTrait::assertNoFieldChecked Deprecated protected function Asserts that a checkbox field in the current page is not checked.
AssertLegacyTrait::assertNoLink Deprecated protected function Passes if a link with the specified label is not found.
AssertLegacyTrait::assertNoLinkByHref Deprecated protected function Passes if a link containing a given href (part) is not found.
AssertLegacyTrait::assertNoOption Deprecated protected function Asserts that a select option does NOT exist in the current page.
AssertLegacyTrait::assertNoRaw Deprecated protected function Passes if the raw text IS not found on the loaded page, fail otherwise.
AssertLegacyTrait::assertNotEqual Deprecated protected function
AssertLegacyTrait::assertNoText Deprecated protected function Passes if the page (with HTML stripped) does not contains the text.
AssertLegacyTrait::assertNotIdentical Deprecated protected function
AssertLegacyTrait::assertNoUniqueText Deprecated protected function Passes if the text is found MORE THAN ONCE on the text version of the page.
AssertLegacyTrait::assertOption Deprecated protected function Asserts that a select option in the current page exists.
AssertLegacyTrait::assertOptionSelected Deprecated protected function Asserts that a select option in the current page is checked.
AssertLegacyTrait::assertPattern Deprecated protected function Triggers a pass if the Perl regex pattern is found in the raw content.
AssertLegacyTrait::assertRaw Deprecated protected function Passes if the raw text IS found on the loaded page, fail otherwise.
AssertLegacyTrait::assertResponse Deprecated protected function Asserts the page responds with the specified response code.
AssertLegacyTrait::assertText Deprecated protected function Passes if the page (with HTML stripped) contains the text.
AssertLegacyTrait::assertTextHelper protected function Helper for assertText and assertNoText.
AssertLegacyTrait::assertTitle Deprecated protected function Pass if the page title is the given string.
AssertLegacyTrait::assertTrue public static function
AssertLegacyTrait::assertUniqueText Deprecated protected function Passes if the text is found ONLY ONCE on the text version of the page.
AssertLegacyTrait::assertUrl Deprecated protected function Passes if the internal browser's URL matches the given path.
AssertLegacyTrait::buildXPathQuery Deprecated protected function Builds an XPath query.
AssertLegacyTrait::pass Deprecated protected function
AssertLegacyTrait::verbose protected function
BlockCreationTrait::placeBlock protected function Creates a block instance based on default settings. Aliased as: drupalPlaceBlock
BrowserTestBase::$baseUrl protected property The base URL.
BrowserTestBase::$classLoader protected property Class loader.
BrowserTestBase::$configDirectories protected property The config directories used in this test.
BrowserTestBase::$configImporter protected property The config importer that can be used in a test.
BrowserTestBase::$configSchemaCheckerExclusions protected static property An array of config object names that are excluded from schema checking.
BrowserTestBase::$container protected property The dependency injection container used in the test.
BrowserTestBase::$customTranslations protected property An array of custom translations suitable for drupal_rewrite_settings().
BrowserTestBase::$databasePrefix protected property The database prefix of this test run.
BrowserTestBase::$htmlOutputClassName protected property Class name for HTML output logging.
BrowserTestBase::$htmlOutputCounter protected property Counter for HTML output logging.
BrowserTestBase::$htmlOutputCounterStorage protected property Counter storage for HTML output logging.
BrowserTestBase::$htmlOutputDirectory protected property Directory name for HTML output logging.
BrowserTestBase::$htmlOutputEnabled protected property HTML output output enabled.
BrowserTestBase::$htmlOutputFile protected property The file name to write the list of URLs to.
BrowserTestBase::$htmlOutputTestId protected property HTML output test ID.
BrowserTestBase::$kernel protected property The DrupalKernel instance used in the test.
BrowserTestBase::$loggedInUser protected property The current user logged in using the Mink controlled browser.
BrowserTestBase::$mink protected property Mink session manager.
BrowserTestBase::$minkDefaultDriverArgs protected property
BrowserTestBase::$minkDefaultDriverClass protected property 1
BrowserTestBase::$modules protected static property Modules to enable. 52
BrowserTestBase::$originalShutdownCallbacks protected property The original array of shutdown function callbacks.
BrowserTestBase::$originalSiteDirectory protected property The site directory of the original parent site.
BrowserTestBase::$preserveGlobalState protected property
BrowserTestBase::$privateFilesDirectory protected property The private file directory for the test environment.
BrowserTestBase::$profile protected property The profile to install as a basis for testing. 3
BrowserTestBase::$publicFilesDirectory protected property The public file directory for the test environment.
BrowserTestBase::$rootUser protected property The root user.
BrowserTestBase::$runTestInSeparateProcess protected property Browser tests are run in separate processes to prevent collisions between code that may be loaded by tests.
BrowserTestBase::$siteDirectory protected property The site directory of this test run.
BrowserTestBase::$strictConfigSchema protected property Set to TRUE to strict check all configuration saved.
BrowserTestBase::$tempFilesDirectory protected property The temp file directory for the test environment.
BrowserTestBase::$timeLimit protected property Time limit in seconds for the test.
BrowserTestBase::$translationFilesDirectory protected property The translation file directory for the test environment.
BrowserTestBase::assertEquals public static function
BrowserTestBase::assertSession public function Returns WebAssert object. Overrides AssertLegacyTrait::assertSession 1
BrowserTestBase::buildUrl protected function Builds an a absolute URL from a system path or a URL object.
BrowserTestBase::changeDatabasePrefix private function Changes the database connection to the prefixed one.
BrowserTestBase::cleanupEnvironment protected function Clean up the Simpletest environment.
BrowserTestBase::click protected function Clicks the element with the given CSS selector.
BrowserTestBase::clickLink protected function Follows a link by complete name.
BrowserTestBase::config protected function Configuration accessor for tests. Returns non-overridden configuration.
BrowserTestBase::cssSelect protected function Searches elements using a CSS selector in the raw content.
BrowserTestBase::cssSelectToXpath protected function Translates a CSS expression to its XPath equivalent.
BrowserTestBase::drupalGet protected function Retrieves a Drupal path or an absolute path. 1
BrowserTestBase::drupalGetHeader protected function Gets the value of an HTTP response header.
BrowserTestBase::drupalLogin protected function Logs in a user using the Mink controlled browser.
BrowserTestBase::drupalLogout protected function Logs a user out of the Mink controlled browser and confirms.
BrowserTestBase::drupalPostForm protected function Executes a form submission.
BrowserTestBase::drupalUserIsLoggedIn protected function Returns whether a given user account is logged in.
BrowserTestBase::filePreDeleteCallback public static function Ensures test files are deletable within file_unmanaged_delete_recursive().
BrowserTestBase::getAbsoluteUrl protected function Takes a path and returns an absolute path.
BrowserTestBase::getConfigSchemaExclusions protected function Gets the config schema exclusions for this test.
BrowserTestBase::getDatabaseConnection public static function Returns the database connection to the site running Simpletest.
BrowserTestBase::getDefaultDriverInstance protected function Gets an instance of the default Mink driver.
BrowserTestBase::getDrupalSettings protected function Gets the JavaScript drupalSettings variable for the currently-loaded page. 1
BrowserTestBase::getHtmlOutputHeaders protected function Returns headers in HTML output format.
BrowserTestBase::getOptions protected function Helper function to get the options of select field.
BrowserTestBase::getSession public function Returns Mink session.
BrowserTestBase::getTextContent protected function Retrieves the plain-text content from the current page.
BrowserTestBase::getUrl protected function Get the current URL from the browser. 1
BrowserTestBase::htmlOutput protected function Logs a HTML output message in a text file.
BrowserTestBase::initMink protected function Initializes Mink sessions. 1
BrowserTestBase::installDrupal public function Installs Drupal into the Simpletest site.
BrowserTestBase::installParameters protected function Returns the parameters that will be used when Simpletest installs Drupal.
BrowserTestBase::prepareDatabasePrefix private function Generates a database prefix for running tests.
BrowserTestBase::prepareEnvironment protected function Prepares the current environment for running the test.
BrowserTestBase::prepareRequest protected function Prepare for a request to testing site.
BrowserTestBase::prepareRequestForGenerator protected function Creates a mock request and sets it on the generator.
BrowserTestBase::rebuildContainer protected function Rebuilds \Drupal::getContainer().
BrowserTestBase::refreshVariables protected function Refreshes in-memory configuration and state information.
BrowserTestBase::registerSessions protected function Registers additional Mink sessions.
BrowserTestBase::resetAll protected function Resets all data structures after having enabled new modules.
BrowserTestBase::setContainerParameter protected function Changes parameters in the services.yml file.
BrowserTestBase::setUp protected function 27
BrowserTestBase::submitForm protected function Fills and submits a form.
BrowserTestBase::tearDown protected function 1
BrowserTestBase::writeSettings protected function Rewrites the settings.php file of the test site.
BrowserTestBase::xpath protected function Performs an xpath search on the contents of the internal browser.
BrowserTestBase::__sleep public function Prevents serializing any properties.
ConfigTestTrait::configImporter protected function Returns a ConfigImporter object to import test configuration.
ConfigTestTrait::copyConfig protected function Copies configuration objects from source storage to target storage.
ContentTypeCreationTrait::createContentType protected function Creates a custom content type based on default settings. Aliased as: drupalCreateContentType
NodeCreationTrait::createNode protected function Creates a node based on default settings. Aliased as: drupalCreateNode
NodeCreationTrait::getNodeByTitle function Get a node from the database based on its title. Aliased as: drupalGetNodeByTitle
RandomGeneratorTrait::$randomGenerator protected property The random generator.
RandomGeneratorTrait::getRandomGenerator protected function Gets the random generator for the utility methods.
RandomGeneratorTrait::randomMachineName protected function Generates a unique random string containing letters and numbers.
RandomGeneratorTrait::randomObject public function Generates a random PHP object.
RandomGeneratorTrait::randomString public function Generates a pseudo-random string of ASCII characters of codes 32 to 126.
RandomGeneratorTrait::randomStringValidate public function Callback for random string validation.
SessionTestTrait::$sessionName protected property The name of the session cookie.
SessionTestTrait::generateSessionName protected function Generates a session cookie name.
SessionTestTrait::getSessionName protected function Returns the session name in use on the child site.
UserCreationTrait::checkPermissions protected function Checks whether a given list of permission names is valid.
UserCreationTrait::createAdminRole protected function Creates an administrative role.
UserCreationTrait::createRole protected function Creates a role with specified permissions. Aliased as: drupalCreateRole
UserCreationTrait::createUser protected function Create a user with a given set of permissions. Aliased as: drupalCreateUser
UserCreationTrait::grantPermissions protected function Grant permissions to a user role.
UserCreationTrait::setCurrentUser protected function Switch the current logged in user.