@@ -34,7 +34,7 @@ public function testStreamOpenShouldAppendFilters(bool $expected, int $option, ?
3434 {
3535 $ mock = $ this ->getMockBuilder ('VCR\Util\StreamProcessor ' )
3636 ->disableOriginalConstructor ()
37- ->setMethods (['intercept ' , 'restore ' , 'appendFiltersToStream ' , 'shouldProcess ' ])
37+ ->onlyMethods (['intercept ' , 'restore ' , 'appendFiltersToStream ' , 'shouldProcess ' ])
3838 ->getMock ();
3939
4040 if (null !== $ shouldProcess ) {
@@ -109,8 +109,22 @@ public function testUrlStatSuccessfully(): void
109109 public function testUrlStatFileNotFound (): void
110110 {
111111 $ processor = new StreamProcessor ();
112- $ this ->expectWarning ();
113- $ processor ->url_stat ('file_not_found ' , 0 );
112+
113+ set_error_handler (static function (
114+ int $ errno ,
115+ string $ errstr ,
116+ string $ errfile = '' ,
117+ int $ errline = 0
118+ ): void {
119+ throw new \ErrorException ($ errstr , 0 , $ errno , $ errfile , $ errline );
120+ }, \E_WARNING );
121+
122+ try {
123+ $ this ->expectException (\ErrorException::class);
124+ $ processor ->url_stat ('file_not_found ' , 0 );
125+ } finally {
126+ restore_error_handler ();
127+ }
114128 }
115129
116130 /**
@@ -195,7 +209,7 @@ protected function getStreamProcessorMock()
195209 {
196210 return $ this ->getMockBuilder (StreamProcessor::class)
197211 ->disableOriginalConstructor ()
198- ->setMethods (['intercept ' , 'restore ' ])
212+ ->onlyMethods (['intercept ' , 'restore ' ])
199213 ->getMock ();
200214 }
201215}
0 commit comments