diff core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
line wrap: on
line diff
--- a/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php	Thu Apr 26 11:26:54 2018 +0100
+++ b/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php	Tue Jul 10 15:07:59 2018 +0100
@@ -385,6 +385,21 @@
     return $data;
   }
 
+  /**
+   * Ensure that classes are not reflected when the docblock is empty.
+   *
+   * @covers ::getTestInfo
+   */
+  public function testGetTestInfoEmptyDocblock() {
+    // If getTestInfo() performed reflection, it won't be able to find the
+    // class we asked it to analyze, so it will throw a ReflectionException.
+    // We want to make sure it didn't do that, because we already did some
+    // analysis and already have an empty docblock. getTestInfo() will throw
+    // MissingGroupException because the annotation is empty.
+    $this->setExpectedException(MissingGroupException::class);
+    TestDiscovery::getTestInfo('Drupal\Tests\simpletest\ThisTestDoesNotExistTest', '');
+  }
+
 }
 
 class TestTestDiscovery extends TestDiscovery {