@@ -33,7 +33,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
3333
3434 protected function setUp (): void {
3535 parent ::setUp ();
36- $ this ->reflector = new ControllerMethodReflector ();
36+ $ this ->reflector = new ControllerMethodReflector (\ OCP \Server:: get (LoggerInterface::class) );
3737 $ this ->session = $ this ->createMock (Session::class);
3838 $ this ->throttler = $ this ->createMock (IThrottler::class);
3939 $ this ->logger = $ this ->createMock (LoggerInterface::class);
@@ -79,6 +79,7 @@ public function testNoAnnotationNoCORSHEADER(): void {
7979 $ this ->createMock (IRequestId::class),
8080 $ this ->createMock (IConfig::class)
8181 );
82+ $ this ->reflector ->reflect ($ this ->controller , __FUNCTION__ );
8283 $ middleware = new CORSMiddleware ($ request , new MiddlewareUtils ($ this ->reflector , $ this ->logger ), $ this ->session , $ this ->throttler );
8384
8485 $ response = $ middleware ->afterController ($ this ->controller , __FUNCTION__ , new Response ());
@@ -300,6 +301,7 @@ public function testAfterExceptionWithSecurityExceptionNoStatus(): void {
300301 $ this ->createMock (IRequestId::class),
301302 $ this ->createMock (IConfig::class)
302303 );
304+ $ this ->reflector ->reflect ($ this ->controller , __FUNCTION__ );
303305 $ middleware = new CORSMiddleware ($ request , new MiddlewareUtils ($ this ->reflector , $ this ->logger ), $ this ->session , $ this ->throttler );
304306 $ response = $ middleware ->afterException ($ this ->controller , __FUNCTION__ , new SecurityException ('A security exception ' ));
305307
@@ -316,6 +318,7 @@ public function testAfterExceptionWithSecurityExceptionWithStatus(): void {
316318 $ this ->createMock (IRequestId::class),
317319 $ this ->createMock (IConfig::class)
318320 );
321+ $ this ->reflector ->reflect ($ this ->controller , __FUNCTION__ );
319322 $ middleware = new CORSMiddleware ($ request , new MiddlewareUtils ($ this ->reflector , $ this ->logger ), $ this ->session , $ this ->throttler );
320323 $ response = $ middleware ->afterException ($ this ->controller , __FUNCTION__ , new SecurityException ('A security exception ' , 501 ));
321324
@@ -335,6 +338,7 @@ public function testAfterExceptionWithRegularException(): void {
335338 $ this ->createMock (IRequestId::class),
336339 $ this ->createMock (IConfig::class)
337340 );
341+ $ this ->reflector ->reflect ($ this ->controller , __FUNCTION__ );
338342 $ middleware = new CORSMiddleware ($ request , new MiddlewareUtils ($ this ->reflector , $ this ->logger ), $ this ->session , $ this ->throttler );
339343 $ middleware ->afterException ($ this ->controller , __FUNCTION__ , new \Exception ('A regular exception ' ));
340344 }
0 commit comments