class WebDriverTestBaseTest
Same name and namespace in other branches
- 10 core/tests/Drupal/Tests/Core/Test/WebDriverTestBaseTest.php \Drupal\Tests\Core\Test\WebDriverTestBaseTest
Tests Drupal\FunctionalJavascriptTests\WebDriverTestBase.
Attributes
#[CoversClass(WebDriverTestBase::class)]
#[Group('Test')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Test\WebDriverTestBaseTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of WebDriverTestBaseTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Test/ WebDriverTestBaseTest.php, line 18
Namespace
Drupal\Tests\Core\TestView source
class WebDriverTestBaseTest extends UnitTestCase {
/**
* Tests W3C setting is added to goog:chromeOptions as expected.
*
* @legacy-covers ::getMinkDriverArgs
*/
public function testCapabilities($expected, ?string $mink_driver_args_webdriver, ?bool $deprecated = FALSE, ?string $mink_driver_args = NULL) : void {
$this->putEnv("MINK_DRIVER_ARGS_WEBDRIVER", $mink_driver_args_webdriver);
$this->putEnv("MINK_DRIVER_ARGS", $mink_driver_args);
// @phpstan-ignore testClass.missingAttribute.Group, testClass.missingAttribute.RunInSeparateProcesses
$object = new class ('test') extends WebDriverTestBase {
public function test() : void {
$this->assertEquals(1, 1);
}
};
$method = new \ReflectionMethod($object, 'getMinkDriverArgs');
$this->assertSame($expected, $method->invoke($object));
if ($deprecated) {
$this->expectUserDeprecationMessage('The "w3c" option for Chrome is deprecated in drupal:11.4.0 and will be forced to TRUE in drupal:12.0.0. See https://www.drupal.org/node/3460567');
}
}
/**
* Sets or deletes an environment variable.
*
* @param string $variable
* The environment variable to set or delete.
* @param string|null $value
* The value to set the variable to. If the value is NULL then the
* environment variable will be unset.
*
* @return void
* No return value.
*/
private function putEnv(string $variable, ?string $value) : void {
if (is_string($value)) {
putenv($variable . "=" . $value);
}
else {
putenv($variable);
}
}
}
Members
| Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overrides |
|---|---|---|---|---|---|
| DrupalTestCaseTrait::$root | protected | property | The Drupal root directory. | ||
| DrupalTestCaseTrait::checkErrorHandlerOnTearDown | public | function | Checks the test error handler after test execution. | 1 | |
| DrupalTestCaseTrait::checkLegacySymfonyDeprecationHelperEnvVariable | public | function | Checks legacy SYMFONY_DEPRECATIONS_HELPER env variable is not used. | ||
| DrupalTestCaseTrait::expectExceptionMessageIs | protected | function | Expects an exactly matching exception message. | ||
| DrupalTestCaseTrait::expectExceptionMessageIsOrContains | protected | function | Expects an exception message containing a specified string. | ||
| DrupalTestCaseTrait::getDrupalRoot | Deprecated | protected static | function | Returns the Drupal root directory. | 1 |
| DrupalTestCaseTrait::setDebugDumpHandler | public static | function | Registers the dumper CLI handler when the DebugDump extension is enabled. | ||
| DrupalTestCaseTrait::setUpRoot | final protected | function | Ensure that the $root property is set initially. | ||
| ExpectDeprecationTrait::expectDeprecation | Deprecated | public | function | Adds an expected deprecation. | |
| ExpectDeprecationTrait::regularExpressionForFormatDescription | private | function | |||
| 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. | ||
| UnitTestCase::getClassResolverStub | protected | function | Returns a stub class resolver. | ||
| UnitTestCase::getConfigFactoryStub | public | function | Returns a stub config factory that behaves according to the passed array. | ||
| UnitTestCase::getContainerWithCacheTagsInvalidator | protected | function | Sets up a container with a cache tags invalidator. | ||
| UnitTestCase::getStringTranslationStub | public | function | Returns a stub translation manager that just returns the passed string. | ||
| UnitTestCase::setUp | protected | function | 379 | ||
| UnitTestCase::setupMockIterator | protected | function | Set up a traversable class mock to return specific items when iterated. | ||
| WebDriverTestBaseTest::putEnv | private | function | Sets or deletes an environment variable. | ||
| WebDriverTestBaseTest::testCapabilities | public | function | Tests W3C setting is added to goog:chromeOptions as expected. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.