diff core/tests/Drupal/Tests/ExpectDeprecationTest.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/tests/Drupal/Tests/ExpectDeprecationTest.php	Thu Jul 05 14:24:15 2018 +0000
@@ -0,0 +1,36 @@
+<?php
+
+namespace Drupal\Tests;
+
+use Drupal\Tests\Traits\ExpectDeprecationTrait;
+
+/**
+ * @coversDefaultClass \Drupal\Tests\Traits\ExpectDeprecationTrait
+ *
+ * @group Test
+ * @group legacy
+ */
+class ExpectDeprecationTest extends UnitTestCase {
+  use ExpectDeprecationTrait;
+
+  /**
+   * @covers ::expectDeprecation
+   */
+  public function testExpectDeprecation() {
+    $this->expectDeprecation('Test deprecation');
+    @trigger_error('Test deprecation', E_USER_DEPRECATED);
+  }
+
+  /**
+   * @covers ::expectDeprecation
+   * @runInSeparateProcess
+   * @preserveGlobalState disabled
+   */
+  public function testExpectDeprecationInIsolation() {
+    $this->expectDeprecation('Test isolated deprecation');
+    $this->expectDeprecation('Test isolated deprecation2');
+    @trigger_error('Test isolated deprecation', E_USER_DEPRECATED);
+    @trigger_error('Test isolated deprecation2', E_USER_DEPRECATED);
+  }
+
+}