diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php index f4cb5ec47f..f2fc10dd7b 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -94,6 +94,7 @@ public function testGetParameter() { */ public function testGetParameterIfNotFound() { $this->expectException(ParameterNotFoundException::class); + $this->container->getParameter('parameter_that_does_not_exist'); } /** diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php index 33250b304b..ffa92efd66 100644 --- a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php +++ b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php @@ -102,7 +102,13 @@ public function testObjectSupportDisabledPecl() { * @see \Drupal\Tests\Component\Serialization\YamlTest::testObjectSupportDisabledPecl() */ public function testObjectSupportDisabledSymfony() { - $this->setExpectedExceptionRegExp(InvalidDataTypeException::class, '/^Object support when parsing a YAML file has been disabled/'); + if (method_exists($this, 'setExpectedExceptionRegExp')) { + $this->setExpectedExceptionRegExp(InvalidDataTypeException::class, '/^Object support when parsing a YAML file has been disabled/'); + } + else { + $this->expectException(InvalidDataTypeException::class); + $this->expectExceptionMessageRegExp('/^Object support when parsing a YAML file has been disabled/'); + } $object = new \stdClass(); $object->foo = 'bar'; // In core all Yaml encoding is done via Symfony and it does not support