Browse Source

Add alias for PHPUnit\Framework\Error\Notice

Edgaras Janušauskas 7 years ago
parent
commit
ae397d7738
2 changed files with 2 additions and 5 deletions
  1. 1 5
      tests/TestCase/Controller/ControllerTest.php
  2. 1 0
      tests/phpunit_aliases.php

+ 1 - 5
tests/TestCase/Controller/ControllerTest.php

@@ -300,11 +300,7 @@ class ControllerTest extends TestCase
         $controller->Bar = true;
         $this->assertTrue($controller->Bar);
 
-        if (class_exists(Notice::class)) {
-            $this->expectException(Notice::class);
-        } else {
-            $this->expectException(\PHPUnit_Framework_Error_Notice::class);
-        }
+        $this->expectException(Notice::class);
         $this->expectExceptionMessage(sprintf(
             'Undefined property: Controller::$Foo in %s on line %s',
             __FILE__,

+ 1 - 0
tests/phpunit_aliases.php

@@ -11,6 +11,7 @@ if (class_exists('PHPUnit_Runner_Version')) {
         class_alias('PHPUnit_Framework_TestResult', 'PHPUnit\Framework\TestResult');
         class_alias('PHPUnit_Framework_Error', 'PHPUnit\Framework\Error\Error');
         class_alias('PHPUnit_Framework_Error_Deprecated', 'PHPUnit\Framework\Error\Deprecated');
+        class_alias('PHPUnit_Framework_Error_Notice', 'PHPUnit\Framework\Error\Notice');
         class_alias('PHPUnit_Framework_Error_Warning', 'PHPUnit\Framework\Error\Warning');
         class_alias('PHPUnit_Framework_ExpectationFailedException', 'PHPUnit\Framework\ExpectationFailedException');
     }