@@ -87,7 +87,7 @@ public function testSapiWindowsVt100SupportWarnsOnInvalidInputType()
8787 $ this ->markTestSkipped ('Windows only test ' );
8888 }
8989
90- $ this ->setExpectedException ('PHPUnit_Framework_Error_Warning ' , 'expects parameter 1 to be resource ' );
90+ $ this ->setExpectedException ('PHPUnit\Framework\Error\Warning ' , 'expects parameter 1 to be resource ' );
9191 sapi_windows_vt100_support ('foo ' , true );
9292 }
9393
@@ -100,7 +100,7 @@ public function testSapiWindowsVt100SupportWarnsOnInvalidStream()
100100 $ this ->markTestSkipped ('Windows only test ' );
101101 }
102102
103- $ this ->setExpectedException ('PHPUnit_Framework_Error_Warning ' , 'was not able to analyze the specified stream ' );
103+ $ this ->setExpectedException ('PHPUnit\Framework\Error\Warning ' , 'was not able to analyze the specified stream ' );
104104 sapi_windows_vt100_support (fopen ('php://memory ' , 'wb ' ), true );
105105 }
106106
@@ -119,7 +119,20 @@ public function testStreamIsatty()
119119 */
120120 public function testStreamIsattyWarnsOnInvalidInputType ()
121121 {
122- $ this ->setExpectedException ('PHPUnit_Framework_Error_Warning ' , 'expects parameter 1 to be resource ' );
122+ $ this ->setExpectedException ('PHPUnit\Framework\Error\Warning ' , 'expects parameter 1 to be resource ' );
123123 stream_isatty ('foo ' );
124124 }
125+
126+ public function setExpectedException ($ exception , $ message = '' , $ code = null )
127+ {
128+ if (!class_exists ('PHPUnit\Framework\Error\Notice ' )) {
129+ $ exception = str_replace ('PHPUnit \\Framework \\Error \\' , 'PHPUnit_Framework_Error_ ' , $ exception );
130+ }
131+ if (method_exists ($ this , 'expectException ' )) {
132+ $ this ->expectException ($ exception );
133+ $ this ->expectExceptionMessage ($ message );
134+ } else {
135+ parent ::setExpectedException ($ exception , $ message , $ code );
136+ }
137+ }
125138}
0 commit comments