class BrowserTestBaseTest
Same name in this branch
- 9 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest
- 9 core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest
- 11.x core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest
- 10 core/tests/Drupal/KernelTests/Core/Test/BrowserTestBaseTest.php \Drupal\KernelTests\Core\Test\BrowserTestBaseTest
- 10 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest
- 10 core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest
- 8.9.x core/tests/Drupal/KernelTests/Core/Test/BrowserTestBaseTest.php \Drupal\KernelTests\Core\Test\BrowserTestBaseTest
- 8.9.x core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest
- 8.9.x core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest
@group Test @group FunctionalTests
@coversDefaultClass \Drupal\Tests\BrowserTestBase
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\Test\BrowserTestBaseTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of BrowserTestBaseTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Test/ BrowserTestBaseTest.php, line 16
Namespace
Drupal\KernelTests\Core\TestView source
class BrowserTestBaseTest extends KernelTestBase {
/**
* Tests that a test method is skipped when it requires a module not present.
*
* In order to catch checkRequirements() regressions, we have to make a new
* test object and run checkRequirements() here.
*
* @covers ::checkRequirements
* @covers ::checkModuleRequirements
*/
public function testMethodRequiresModule() {
require __DIR__ . '/../../../../fixtures/BrowserMissingDependentModuleMethodTest.php';
$stub_test = new BrowserMissingDependentModuleMethodTest();
// We have to setName() to the method name we're concerned with.
$stub_test->setName('testRequiresModule');
// We cannot use $this->setExpectedException() because PHPUnit would skip
// the test before comparing the exception type.
try {
$stub_test->publicCheckRequirements();
$this->fail('Missing required module throws skipped test exception.');
} catch (SkippedTestError $e) {
$this->assertEquals('Required modules: module_does_not_exist', $e->getMessage());
}
}
/**
* Tests that a test case is skipped when it requires a module not present.
*
* In order to catch checkRequirements() regressions, we have to make a new
* test object and run checkRequirements() here.
*
* @covers ::checkRequirements
* @covers ::checkModuleRequirements
*/
public function testRequiresModule() {
require __DIR__ . '/../../../../fixtures/BrowserMissingDependentModuleTest.php';
$stub_test = new BrowserMissingDependentModuleTest();
// We have to setName() to the method name we're concerned with.
$stub_test->setName('testRequiresModule');
// We cannot use $this->setExpectedException() because PHPUnit would skip
// the test before comparing the exception type.
try {
$stub_test->publicCheckRequirements();
$this->fail('Missing required module throws skipped test exception.');
} catch (SkippedTestError $e) {
$this->assertEquals('Required modules: module_does_not_exist', $e->getMessage());
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.