Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / Drupal / Tests / Component / Discovery / YamlDirectoryDiscoveryTest.php
index 86134a7bdf10098c22db00fe917e6154799afb47..9ac807d744d031d456229b9c4b47156fd30a26dd 100644 (file)
@@ -124,7 +124,13 @@ class YamlDirectoryDiscoveryTest extends TestCase {
    * @covers ::getIdentifier
    */
   public function testDiscoveryNoIdException() {
-    $this->setExpectedException(DiscoveryException::class, 'The vfs://modules/test_1/item_1.test.yml contains no data in the identifier key \'id\'');
+    if (method_exists($this, 'expectException')) {
+      $this->expectException(DiscoveryException::class);
+      $this->expectExceptionMessage('The vfs://modules/test_1/item_1.test.yml contains no data in the identifier key \'id\'');
+    }
+    else {
+      $this->setExpectedException(DiscoveryException::class, 'The vfs://modules/test_1/item_1.test.yml contains no data in the identifier key \'id\'');
+    }
     vfsStream::setup('modules', NULL, [
       'test_1' => [
         'item_1.test.yml' => "",
@@ -144,7 +150,13 @@ class YamlDirectoryDiscoveryTest extends TestCase {
    * @covers ::findAll
    */
   public function testDiscoveryInvalidYamlException() {
-    $this->setExpectedException(DiscoveryException::class, 'The vfs://modules/test_1/item_1.test.yml contains invalid YAML');
+    if (method_exists($this, 'expectException')) {
+      $this->expectException(DiscoveryException::class);
+      $this->expectExceptionMessage('The vfs://modules/test_1/item_1.test.yml contains invalid YAML');
+    }
+    else {
+      $this->setExpectedException(DiscoveryException::class, 'The vfs://modules/test_1/item_1.test.yml contains invalid YAML');
+    }
     vfsStream::setup('modules', NULL, [
       'test_1' => [
         'item_1.test.yml' => "id: invalid\nfoo : [bar}",