diff core/modules/simpletest/tests/src/Kernel/TestDiscoveryDeprecationTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/simpletest/tests/src/Kernel/TestDiscoveryDeprecationTest.php	Thu Feb 28 13:21:36 2019 +0000
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\Tests\simpletest\Kernel;
+
+use Drupal\KernelTests\KernelTestBase;
+
+/**
+ * @group simpletest
+ * @group legacy
+ *
+ * @coversDefaultClass \Drupal\simpletest\TestDiscovery
+ */
+class TestDiscoveryDeprecationTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['simpletest', 'simpletest_deprecation_test'];
+
+  /**
+   * @expectedDeprecation The deprecated alter hook hook_simpletest_alter() is implemented in these functions: simpletest_deprecation_test_simpletest_alter. Convert your test to a PHPUnit-based one and implement test listeners. See: https://www.drupal.org/node/2939892
+   * @covers ::getTestClasses
+   */
+  public function testHookSimpletestAlter() {
+    // The simpletest_test module implements hook_simpletest_alter(), which
+    // should trigger a deprecation error during getTestClasses().
+    $this->assertNotEmpty(
+      $this->container->get('test_discovery')->getTestClasses()
+    );
+  }
+
+}