Browse Source

test deprecated with assert after trigger warning

saeid 4 years ago
parent
commit
d517a1972e
1 changed files with 17 additions and 0 deletions
  1. 17 0
      tests/TestCase/TestSuite/TestCaseTest.php

+ 17 - 0
tests/TestCase/TestSuite/TestCaseTest.php

@@ -157,6 +157,23 @@ class TestCaseTest extends TestCase
     }
 
     /**
+     * test deprecated with assert after trigger warning
+     */
+    public function testDeprecatedWithAssertAfterTriggerWarning(): void
+    {
+        try {
+            $this->deprecated(function () {
+                trigger_error('deprecation message', E_USER_DEPRECATED);
+                $this->assertTrue(false, 'A random message');
+            });
+
+            $this->fail();
+        } catch (\Exception $e) {
+            $this->assertStringContainsString('A random message', $e->getMessage());
+        }
+    }
+
+    /**
      * test deprecated
      */
     public function testDeprecatedWithNoDeprecation(): void