SimpleTestErrorCollectorTest
class SimpleTestErrorCollectorTest extends WebTestBase (View source)
Tests SimpleTest error and exception collector.
Traits
Defines a trait for shared functional test setup functionality.
Provides test assertions for testing page-level cache contexts & tags.
Provides methods for testing emails sent during test runs.
Provides a method to refresh in-memory configuration and state information.
Provides a trait for shared test setup functionality.
Properties
| static protected string[] | $configSchemaCheckerExclusions | An array of config object names that are excluded from schema checking. |
from TestSetupTrait |
| protected ContainerInterface | $container | The dependency injection container used in the test. |
from TestSetupTrait |
| protected string | $siteDirectory | The site directory of this test run. |
from TestSetupTrait |
| protected string | $publicFilesDirectory | The public file directory for the test environment. |
from TestSetupTrait |
| protected string | $originalSite | The site directory of the original parent site. |
from TestSetupTrait |
| protected string | $privateFilesDirectory | The private file directory for the test environment. |
from TestSetupTrait |
| protected bool | $strictConfigSchema | Set to TRUE to strict check all configuration saved. |
from TestSetupTrait |
| protected DrupalKernel | $kernel | The DrupalKernel instance used in the test. |
from TestSetupTrait |
| protected string | $tempFilesDirectory | The temporary file directory for the test environment. |
from TestSetupTrait |
| protected string | $testId | The test run ID. |
from TestSetupTrait |
| protected string | $databasePrefix | The database prefix of this test run. |
from TestBase |
| protected int | $timeLimit | Time limit for the test. |
from TestBase |
| array | $results | Current results of this test case. |
from TestBase |
| protected array | $assertions | Assertions thrown in that test case. |
from TestBase |
| protected | $skipClasses | This class is skipped when looking for the source of an assertion. |
from TestBase |
| bool | $verbose | TRUE if verbose debugging is enabled. |
from TestBase |
| protected int | $verboseId | Incrementing identifier for verbose output filenames. |
from TestBase |
| protected string | $verboseClassName | Safe class name for use in verbose output filenames. |
from TestBase |
| protected string | $verboseDirectory | Directory where verbose output files are put. |
from TestBase |
| protected string | $verboseDirectoryUrl | URL to the verbose output file directory. |
from TestBase |
| protected string | $originalConf | The original configuration (variables), if available. |
from TestBase |
| protected string | $originalConfig | The original configuration (variables). |
from TestBase |
| protected array | $originalConfigDirectories | The original configuration directories. |
from TestBase |
| protected ContainerInterface | $originalContainer | The original container. |
from TestBase |
| protected string | $originalFileDirectory | The original file directory, before it was changed for testing purposes. |
from TestBase |
| protected LanguageInterface | $originalLanguage | The original language. |
from TestBase |
| protected string | $originalPrefix | The original database prefix when running inside Simpletest. |
from TestBase |
| protected string | $originalSessionName | The name of the session cookie of the test-runner. |
from TestBase |
| protected array | $originalSettings | The settings array. |
from TestBase |
| protected array | $originalShutdownCallbacks | The original shutdown handlers array, before it was cleaned for testing. |
from WebTestBase |
| protected object | $originalUser | The original user, before it was changed to a clean uid = 1 for testing. |
from WebTestBase |
| protected string | $translationFilesDirectory | The translation file directory for the test environment. |
from TestBase |
| bool | $dieOnFail | Whether to die in case any test assertion fails. |
from TestBase |
| protected ConfigImporter | $configImporter | The config importer that can used in a test. |
from TestBase |
| protected int | $httpAuthMethod | HTTP authentication method (specified as a CURLAUTH_* constant). |
from TestBase |
| protected string | $httpAuthCredentials | HTTP authentication credentials ( |
from TestBase |
| protected AccountInterface | $rootUser | The "#1" admin user. |
from FunctionalTestSetupTrait |
| protected Classloader | $classLoader | The class loader to use for installation and initialization of setup. |
from FunctionalTestSetupTrait |
| protected deprecated | $configDirectories | The config directories used in this test. |
from FunctionalTestSetupTrait |
| protected bool | $apcuEnsureUniquePrefix | The flag to set 'apcu_ensure_unique_prefix' setting. |
from FunctionalTestSetupTrait |
| protected string | $profile | The profile to install as a basis for testing. |
from WebTestBase |
| protected string | $url | The URL currently loaded in the internal browser. |
from WebTestBase |
| protected resource | $curlHandle | The handle of the current cURL connection. |
from WebTestBase |
| protected bool | $assertAjaxHeader | Whether or not to assert the presence of the X-Drupal-Ajax-Token. |
from WebTestBase |
| protected array | $headers | The headers of the page currently loaded in the internal browser. |
from WebTestBase |
| protected array | $cookies | The cookies of the page currently loaded in the internal browser. |
from WebTestBase |
| protected bool | $dumpHeaders | Indicates that headers should be dumped if verbose output is enabled. |
from WebTestBase |
| protected AccountInterface|bool | $loggedInUser | The current user logged in using the internal browser. |
from WebTestBase |
| protected | $cookieFile | The current cookie file used by cURL. |
from WebTestBase |
| protected | $additionalCurlOptions | Additional cURL options. |
from WebTestBase |
| protected array | $originalBatch | The original batch, before it was changed for testing purposes. |
from WebTestBase |
| protected | $sessionId | The current session ID, if available. |
from WebTestBase |
| protected int | $maximumRedirects | The maximum number of redirects to follow when handling responses. |
from WebTestBase |
| protected int | $redirectCount | The number of redirects followed during the handling of a request. |
from WebTestBase |
| protected null|int | $maximumMetaRefreshCount | The number of meta refresh redirects to follow, or NULL if unlimited. |
from WebTestBase |
| protected int | $metaRefreshCount | The number of meta refresh redirects followed during ::drupalGet(). |
from WebTestBase |
| protected array | $curlCookies | Cookies to set on curl requests. |
from WebTestBase |
| protected array | $customTranslations | An array of custom translations suitable for drupal_rewrite_settings(). |
from WebTestBase |
| static array | $modules | Modules to enable. |
|
| protected array | $collectedErrors | Errors triggered during the test. |
Methods
Returns the database connection to the site running Simpletest.
Gets the config schema exclusions for this test.
Fail the test if it belongs to a PHPUnit-based framework.
Helper method to store an assertion record in the configured database.
Internal helper: stores the assert.
Store an assertion from outside the testing context.
Cycles through backtrace until the first non-assertion method is found.
Check to see if a value is not false.
Check to see if a value is false.
Check to see if a value is NULL.
Check to see if a value is not NULL.
Check to see if two values are equal.
Check to see if two values are not equal.
Check to see if two values are identical.
Check to see if two values are not identical.
Checks to see if two objects are identical.
Asserts that no errors have been logged to the PHP error.log thus far.
Asserts that a specific error has been logged to the PHP error log.
Stores errors into an array.
Act on global state information before the environment is altered for a test.
Handle errors during test runs.
Refreshes in-memory configuration and state information.
Prepares site settings and services before installation.
Rewrites the settings.php file of the test site.
Changes parameters in the services.yml file.
Resets all data structures after having enabled new modules.
Creates a mock request and sets it on the generator.
Initialize various configurations post-installation.
Initializes the kernel after installation.
Installs the default theme defined by static::$defaultTheme when needed.
Install modules defined by static::$modules.
Returns the parameters that will be used when Simpletest installs Drupal.
Sets up the base URL based upon the environment variable.
Prepares the current environment for running the test.
Returns all supported database driver installer objects.
Gets a specific header value as array.
Asserts whether an expected cache context was present in the last response.
Asserts that a cache context was not present in the last response.
Asserts page cache miss, then hit for the given URL; checks cache headers.
Provides debug information for cache tags.
Ensures that some cache tags are present in the current response.
Ensures that some cache contexts are present in the current response.
Asserts the max age header.
Gets an array containing all emails sent during this test case.
Asserts that the most recently sent email message has the given value.
Asserts that the most recently sent email message has the string in it.
Asserts that the most recently sent email message has the pattern in it.
Outputs to verbose the most recent $count emails sent.
Queues custom translations to be written to settings.php.
Writes custom translations to the test site's settings.php.
Initializes and executes a cURL request.
Reads headers and registers errors received from the tested site.
Returns whether the test is being executed from within a test site.
Retrieves a Drupal path or an absolute path.
Retrieves a Drupal path or an absolute path and JSON decodes the result.
Retrieves a Drupal path or an absolute path for a given format.
Requests a path or URL in drupal_ajax format and JSON-decodes the response.
Requests a Drupal path or an absolute path as if it is a XMLHttpRequest.
Executes a form submission.
Executes an Ajax form submission.
Processes an AJAX response into current content.
Perform a POST HTTP request.
Performs a POST HTTP request with a specific format.
Get the Ajax page state from drupalSettings and prepare it for POSTing.
Transforms a nested array into a flat array suitable for WebTestBase::drupalPostForm().
Checks for meta refresh tag and if found call drupalGet() recursively.
Retrieves only the headers for a Drupal path or an absolute path.
Handles form input related to drupalPostForm().
Provides a helper for ::clickLink() and ::clickLinkPartialName().
Gets the HTTP response headers of the requested page.
Gets the value of an HTTP response header.
Check if a HTTP response header exists and has the expected value.
Passes if the internal browser's URL matches the given path.
Asserts the page responds with the specified response code.
Asserts the page did not return the specified response code.
Builds an a absolute URL from a system path or a URL object.
Asserts whether an expected cache tag was present in the last response.
Asserts whether an expected cache tag was absent in the last response.
Enables/disables the cacheability headers.
Tests that simpletest collects errors from the tested site.
Asserts that a collected error matches what we are expecting.
Details
static Connection
getDatabaseConnection()
Returns the database connection to the site running Simpletest.
protected
prepareDatabasePrefix()
Generates a database prefix for running tests.
The database prefix is used by prepareEnvironment() to setup a public files directory for the test to be run, which also contains the PHP error log, which is written to in case of a fatal error. Since that directory is based on the database prefix, all tests (even unit tests) need to have one, in order to access and read the error log.
The generated database table prefix is used for the Drupal installation being performed for the test. It is also used as user agent HTTP header value by the cURL-based browser of WebTestBase, which is sent to the Drupal installation of the test. During early Drupal bootstrap, the user agent HTTP header is parsed, and if it matches, all database queries use the database table prefix that has been generated here.
protected
changeDatabasePrefix()
Changes the database connection to the prefixed one.
protected string[]
getConfigSchemaExclusions()
Gets the config schema exclusions for this test.
__construct($test_id = NULL)
Constructor for \Drupal\simpletest\WebTestBase.
checkTestHierarchyMismatch()
Fail the test if it belongs to a PHPUnit-based framework.
This would probably be caused by automated test conversions such as those in https://www.drupal.org/project/drupal/issues/2770921.
protected
setUp()
Sets up a Drupal site for running functional and integration tests.
Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.
Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.
After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.
protected array
checkRequirements()
Checks the matching requirements for Test.
protected StatementInterface|int|null
storeAssertion(array $assertion)
Helper method to store an assertion record in the configured database.
This method decouples database access from assertion logic.
protected
assert($status, string|MarkupInterface $message = '', $group = 'Other', array $caller = NULL)
Internal helper: stores the assert.
static Message
insertAssert($test_id, $test_class, $status, $message = '', $group = 'Other', array $caller = [])
deprecated
deprecated
Store an assertion from outside the testing context.
This is useful for inserting assertions that can only be recorded after the test case has been destroyed, such as PHP fatal errors. The caller information is not automatically gathered since the caller is most likely inserting the assertion on behalf of other code. In all other respects the method behaves just like \Drupal\simpletest\TestBase::assert() in terms of storing the assertion.
static true
deleteAssert($message_id)
Delete an assertion record by message ID.
protected array
getAssertionCall()
Cycles through backtrace until the first non-assertion method is found.
protected true
assertTrue($value, $message = '', $group = 'Other')
Check to see if a value is not false.
False values are: empty string, 0, NULL, and FALSE.
protected true
assertFalse($value, $message = '', $group = 'Other')
Check to see if a value is false.
False values are: empty string, 0, NULL, and FALSE.
protected true
assertNull($value, $message = '', $group = 'Other')
Check to see if a value is NULL.
protected true
assertNotNull($value, $message = '', $group = 'Other')
Check to see if a value is not NULL.
protected true
assertEqual($first, $second, $message = '', $group = 'Other')
Check to see if two values are equal.
protected true
assertNotEqual($first, $second, $message = '', $group = 'Other')
Check to see if two values are not equal.
protected true
assertIdentical($first, $second, $message = '', $group = 'Other')
Check to see if two values are identical.
protected true
assertNotIdentical($first, $second, $message = '', $group = 'Other')
Check to see if two values are not identical.
protected true
assertIdenticalObject(object $object1, object $object2, $message = '', $group = 'Other')
Checks to see if two objects are identical.
protected bool
assertNoErrorsLogged()
Asserts that no errors have been logged to the PHP error.log thus far.
protected bool
assertErrorLogged(string $error_message)
Asserts that a specific error has been logged to the PHP error log.
protected
pass($message = NULL, $group = 'Other')
Fire an assertion that is always positive.
protected
fail($message = NULL, $group = 'Other')
Fire an assertion that is always negative.
protected
error($message = '', $group = 'Other', array $caller = NULL)
Stores errors into an array.
This test class is trying to verify that simpletest correctly sees errors and warnings. However, it can't generate errors and warnings that propagate up to the testing framework itself, or these tests would always fail. So, this special copy of error() doesn't propagate the errors up the class hierarchy. It just stuffs them into a protected collectedErrors array for various assertions to inspect.
protected
verbose($message)
Logs a verbose message in a text file.
The link to the verbose message will be placed in the test results as a passing assertion with the text '[verbose message]'.
run(array $methods = [])
Run all tests in this class.
Regardless of whether $methods are passed or not, only method names starting with "test" are executed.
protected
beforePrepareEnvironment()
Act on global state information before the environment is altered for a test.
Allows e.g. KernelTestBase to prime system/extension info from the parent site (and inject it into the test environment so as to improve performance).
protected
tearDown()
Cleans up after testing.
Deletes created files and temporary files directory, deletes the tables created by setUp(), and resets the database prefix.
errorHandler($severity, $message, $file = NULL, $line = NULL)
Handle errors during test runs.
Because this is registered in set_error_handler(), it has to be public.
protected
exceptionHandler($exception)
Handle exceptions.
protected
settingsSet($name, $value)
Changes in memory settings.
static
filePreDeleteCallback($path)
Ensures test files are deletable.
Some tests chmod generated files to be read only. During TestBase::restoreEnvironment() and other cleanup operations, these files need to get deleted too.
protected Config
config($name)
Configuration accessor for tests. Returns non-overridden configuration.
string
getDatabasePrefix()
Gets the database prefix.
string
getTempFilesDirectory()
Gets the temporary files directory.
protected
refreshVariables()
Refreshes in-memory configuration and state information.
Useful after a page request is made that changes configuration or state in a different thread.
In other words calling a settings page with $this->drupalPostForm() with a changed value would update configuration to reflect that change, but in the thread that made the call (thread running the test) the changed values would not be picked up.
This method clears the cache and loads a fresh copy.
protected
prepareSettings()
Prepares site settings and services before installation.
protected
writeSettings(array $settings)
Rewrites the settings.php file of the test site.
protected
setContainerParameter(string $name, string $value)
Changes parameters in the services.yml file.
protected
rebuildContainer()
Rebuilds \Drupal::getContainer().
Use this to update the test process's kernel with a new service container. For example, when the list of enabled modules is changed via the internal browser the test process's kernel has a service container with an out of date module list.
protected
resetAll()
Resets all data structures after having enabled new modules.
This method is called by FunctionalTestSetupTrait::rebuildAll() after enabling the requested modules. It must be called again when additional modules are enabled later.
protected Request
prepareRequestForGenerator(bool $clean_urls = TRUE, array $override_server_vars = [])
Creates a mock request and sets it on the generator.
This is used to manipulate how the generator generates paths during tests. It also ensures that calls to $this->drupalGet() will work when running from run-tests.sh because the url generator no longer looks at the global variables that are set there but relies on getting this information from a request object.
protected
doInstall()
Execute the non-interactive installer.
protected
initSettings()
Initialize settings created during install.
protected
initConfig(ContainerInterface $container)
Initialize various configurations post-installation.
protected
initUserSession()
Initializes user 1 for the site to be installed.
protected ContainerInterface
initKernel(Request $request)
Initializes the kernel after installation.
protected
installDefaultThemeFromClassProperty(ContainerInterface $container)
Installs the default theme defined by static::$defaultTheme when needed.
To install a test theme outside of the testing environment, add
protected
installModulesFromClassProperty(ContainerInterface $container)
Install modules defined by static::$modules.
To install test modules outside of the testing environment, add
protected
rebuildAll()
Resets and rebuilds the environment after setup.
protected array
installParameters()
Returns the parameters that will be used when Simpletest installs Drupal.
protected
setupBaseUrl()
Sets up the base URL based upon the environment variable.
protected
prepareEnvironment()
Prepares the current environment for running the test.
Also sets up new resources for the testing environment, such as the public filesystem and configuration directories.
This method is private as it must only be called once by BrowserTestBase::setUp() (multiple invocations for the same test would have unpredictable consequences) and it must not be callable or overridable by test classes.
protected Tasks[]
getDatabaseTypes()
Returns all supported database driver installer objects.
This wraps drupal_get_database_types() for use without a current container.
protected
enablePageCaching()
Enables page caching.
protected string[]
getCacheHeaderValues(string $header_name)
Gets a specific header value as array.
protected
assertCacheContext(string $expected_cache_context)
Asserts whether an expected cache context was present in the last response.
protected
assertNoCacheContext(string $not_expected_cache_context)
Asserts that a cache context was not present in the last response.
protected
assertPageCacheContextsAndTags(Url $url, array $expected_contexts, array $expected_tags)
Asserts page cache miss, then hit for the given URL; checks cache headers.
protected
debugCacheTags(array $actual_tags, array $expected_tags)
Provides debug information for cache tags.
protected
assertCacheTags(array $expected_tags, bool $include_default_tags = TRUE)
Ensures that some cache tags are present in the current response.
protected bool
assertCacheContexts(array $expected_contexts, string $message = NULL, bool $include_default_contexts = TRUE)
Ensures that some cache contexts are present in the current response.
protected
assertCacheMaxAge(int $max_age)
Asserts the max age header.
protected array
getMails(array $filter = [])
Gets an array containing all emails sent during this test case.
protected bool
assertMail(string $name, string $value = '', string $message = '', string $group = 'Email')
Asserts that the most recently sent email message has the given value.
The field in $name must have the content described in $value.
protected bool
assertMailString(string $field_name, string $string, int $email_depth, string $message = '', string $group = 'Other')
Asserts that the most recently sent email message has the string in it.
protected bool
assertMailPattern(string $field_name, string $regex, string $message = '', string $group = 'Other')
Asserts that the most recently sent email message has the pattern in it.
protected
verboseEmail(int $count = 1)
Outputs to verbose the most recent $count emails sent.
protected
assertBlockAppears(Block $block)
Checks to see whether a block appears on the page.
protected
assertNoBlockAppears(Block $block)
Checks to see whether a block does not appears on the page.
protected array
findBlockInstance(Block $block)
Find a block instance on the page.
protected
drupalLogin(AccountInterface $account)
Log in a user with the internal browser.
If a user is already logged in, then the current user is logged out before logging in the specified user.
Please note that neither the current user nor the passed-in user object is populated with data of the logged in user. If you need full access to the user object after logging in, it must be updated manually. If you also need access to the plain-text password of the user (set by drupalCreateUser()), e.g. to log in the same user again, then it must be re-assigned manually. For example:
protected
drupalUserIsLoggedIn(UserInterface $account)
Returns whether a given user account is logged in.
protected
drupalLogout()
Logs a user out of the internal browser and confirms.
Confirms logout by checking the login page.
protected
setBatch()
Preserve the original batch, and instantiate the test batch.
protected
restoreBatch()
Restore the original batch.
protected
addCustomTranslations(string $langcode, array $values)
Queues custom translations to be written to settings.php.
Use WebTestBase::writeCustomTranslations() to apply and write the queued translations.
protected
writeCustomTranslations()
Writes custom translations to the test site's settings.php.
Use TestBase::addCustomTranslations() to queue custom translations before calling this method.
protected
curlInitialize()
Initializes the cURL connection.
If the simpletest_httpauth_credentials variable is set, this function will add HTTP authentication headers. This is necessary for testing sites that are protected by login credentials from public access. See the description of $curl_options for other options.
protected The
curlExec($curl_options, $redirect = FALSE)
Initializes and executes a cURL request.
protected
curlHeaderCallback($curlHandler, $header)
Reads headers and registers errors received from the tested site.
protected
curlClose()
Close the cURL handler and unset the handler.
protected bool
isInChildSite()
Returns whether the test is being executed from within a test site.
Mainly used by recursive tests (i.e. to test the testing framework).
protected string
drupalGet(Url|string $path, array $options = [], array $headers = [])
Retrieves a Drupal path or an absolute path.
protected array
drupalGetJSON(Url|string $path, array $options = [], array $headers = [])
Retrieves a Drupal path or an absolute path and JSON decodes the result.
protected mixed
drupalGetWithFormat(Url|string $path, string $format, array $options = [], array $headers = [])
Retrieves a Drupal path or an absolute path for a given format.
protected array
drupalGetAjax(Url|string $path, array $options = [], array $headers = [])
Requests a path or URL in drupal_ajax format and JSON-decodes the response.
protected string
drupalGetXHR(Url|string $path, array $options = [], array $headers = [])
Requests a Drupal path or an absolute path as if it is a XMLHttpRequest.
protected
drupalPostForm(Url|string $path, $edit, $submit, array $options = [], array $headers = [], $form_html_id = NULL, $extra_post = NULL)
Executes a form submission.
It will be done as usual POST request with SimpleBrowser.
protected An
drupalPostAjaxForm(Url|string $path, $edit, $triggering_element, $ajax_path = NULL, array $options = [], array $headers = [], $form_html_id = NULL, $ajax_settings = NULL)
Executes an Ajax form submission.
This executes a POST as ajax.js does. The returned JSON data is used to update $this->content via drupalProcessAjaxResponse(). It also returns the array of AJAX commands received.
protected
drupalProcessAjaxResponse(string $content, array $ajax_response, array $ajax_settings, array $drupal_settings)
Processes an AJAX response into current content.
This processes the AJAX response as ajax.js does. It uses the response's JSON data, an array of commands, to update $this->content using equivalent DOM manipulation as is used by ajax.js. It does not apply custom AJAX commands though, because emulation is only implemented for the AJAX commands that ship with Drupal core.
protected The
drupalPost(string|Url $path, string $accept, array $post, array $options = [])
Perform a POST HTTP request.
protected string
drupalPostWithFormat(string|Url $path, string $format, array $post, array $options = [])
Performs a POST HTTP request with a specific format.
protected array
getAjaxPageStatePostData()
Get the Ajax page state from drupalSettings and prepare it for POSTing.
protected string
serializePostValues(array $post = [])
Serialize POST HTTP request values.
Encode according to application/x-www-form-urlencoded. Both names and values needs to be urlencoded, according to http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
protected array
translatePostValues(array $values)
Transforms a nested array into a flat array suitable for WebTestBase::drupalPostForm().
protected Either
checkForMetaRefresh()
Checks for meta refresh tag and if found call drupalGet() recursively.
This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive.
protected The
drupalHead($path, array $options = [], array $headers = [])
Retrieves only the headers for a Drupal path or an absolute path.
protected Submit
handleForm($post, $edit, $upload, $submit, $form)
Handles form input related to drupalPostForm().
Ensure that the specified fields exist and attempt to create POST data in the correct manner for the particular field type.
protected string|bool
clickLink(string|MarkupInterface $label, int $index = 0)
Follows a link by complete name.
Will click the first link found with this link text by default, or a later one if an index is given. Match is case sensitive with normalized space. The label is translated label.
If the link is discovered and clicked, the test passes. Fail otherwise.
protected string|bool
clickLinkPartialName(string|MarkupInterface $label, int $index = 0)
Follows a link by partial name.
If the link is discovered and clicked, the test passes. Fail otherwise.
protected bool|string
clickLinkHelper(string|MarkupInterface $label, int $index, string $pattern)
Provides a helper for ::clickLink() and ::clickLinkPartialName().
protected string
getAbsoluteUrl(string $path)
Takes a path and returns an absolute path.
This method is implemented in the way that browsers work, see https://url.spec.whatwg.org/#relative-state for more information about the possible cases.
protected A
drupalGetHeaders($all_requests = FALSE)
Gets the HTTP response headers of the requested page.
Normally we are only interested in the headers returned by the last request. However, if a page is redirected or HTTP authentication is in use, multiple requests will be required to retrieve the page. Headers from all requests may be requested by passing TRUE to this function.
protected The
drupalGetHeader($name, $all_requests = FALSE)
Gets the value of an HTTP response header.
If multiple requests were required to retrieve the page, only the headers from the last request will be checked by default. However, if TRUE is passed as the second argument, all requests will be processed from last to first until the header is found.
protected bool
assertHeader(string $header, string $value, string $message = '', string $group = 'Browser')
Check if a HTTP response header exists and has the expected value.
protected true
assertUrl(Url|string $path, array $options = [], $message = '', $group = 'Other')
Passes if the internal browser's URL matches the given path.
protected Assertion
assertResponse($code, $message = '', $group = 'Browser')
Asserts the page responds with the specified response code.
protected Assertion
assertNoResponse($code, $message = '', $group = 'Browser')
Asserts the page did not return the specified response code.
protected string
buildUrl(string|Url $path, array $options = [])
Builds an a absolute URL from a system path or a URL object.
protected
assertCacheTag(string $expected_cache_tag)
Asserts whether an expected cache tag was present in the last response.
protected
assertNoCacheTag(string $cache_tag)
Asserts whether an expected cache tag was absent in the last response.
protected
setHttpResponseDebugCacheabilityHeaders(bool $value = TRUE)
Enables/disables the cacheability headers.
Sets the http.response.debug_cacheability_headers container parameter.
testErrorCollect()
Tests that simpletest collects errors from the tested site.
assertError($error, $group, $function, $file, $message = NULL)
Asserts that a collected error matches what we are expecting.