protected function ConfigImporterServiceTestBase::expectException in Config Importer and Tools 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/ConfigImporterServiceTestBase.php \Drupal\Tests\config_import\Unit\ConfigImporterServiceTestBase::expectException()
Set expected exception with a regular expression for a message.
Parameters
string $class: FQDN of exception class.
string $regex: Full regular expression for exception message. Placeholders, same as in "sprintf()" function, are available.
string[] ...$arguments: List of items to replace placeholders. Each of them will be processed by "preg_quote()" function.
3 calls to ConfigImporterServiceTestBase::expectException()
- ConfigImporterServiceTest::testImportConfigsFiltered in tests/
src/ Unit/ ConfigImporterServiceTest.php - Check that filtered configuration will not be imported.
- ConfigImporterServiceTest::testSetDirectoryNotExists in tests/
src/ Unit/ ConfigImporterServiceTest.php - Check that configuration directory physically exists.
- ConfigImporterServiceTest::testSetDirectoryWrongType in tests/
src/ Unit/ ConfigImporterServiceTest.php - Check that we unable to set whatever we want.
File
- tests/
src/ Unit/ ConfigImporterServiceTestBase.php, line 52
Class
- ConfigImporterServiceTestBase
- Base abstraction for testing the configuration importer service.
Namespace
Drupal\Tests\config_import\UnitCode
protected function expectException($class, $regex, ...$arguments) {
foreach ($arguments as $i => $argument) {
$arguments[$i] = preg_quote($argument, '/');
}
$this
->setExpectedExceptionRegExp($class, sprintf('/^%s$/', vsprintf($regex, $arguments)));
}