function FailureMarkerTest::testGetMessageWithThrowable
@covers ::getMessage @testWith [true] [false]
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ FailureMarkerTest.php, line 37
Class
- FailureMarkerTest
- @coversDefaultClass \Drupal\package_manager\FailureMarker @group package_manager @internal
Namespace
Drupal\Tests\package_manager\KernelCode
public function testGetMessageWithThrowable(bool $include_backtrace) : void {
$failure_marker = $this->container
->get(FailureMarker::class);
$failure_marker->write($this->createStage(), t('Disastrous catastrophe!'), new \Exception('Witchcraft!'));
$expected_pattern = $include_backtrace ? <<<REGEXP
/^Disastrous catastrophe! Caused by Exception, with this message: Witchcraft!
Backtrace:
#0 .*FailureMarkerTest->testGetMessageWithThrowable\\(true\\)
#1 .*
#2 .*
#3 .*/
REGEXP
: '/^Disastrous catastrophe! Caused by Exception, with this message: Witchcraft!$/';
$this->assertMatchesRegularExpression($expected_pattern, $failure_marker->getMessage($include_backtrace));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.