@@ -420,62 +420,6 @@ public function test_sub_unsubscribe_success()
420420 $ this ->assertEmpty ($ this ->get_subscription_data ());
421421 }
422422
423- public function test_decline_popup_success ()
424- {
425- $ this ->form_helper ->method ('check_form_tokens ' )->willReturn (true );
426- $ this ->request ->method ('is_ajax ' )->willReturn (true );
427- $ this ->user ->data ['user_id ' ] = 2 ;
428- $ this ->user ->data ['is_bot ' ] = false ;
429- $ this ->user ->data ['user_type ' ] = USER_NORMAL ;
430-
431- $ response = $ this ->controller ->decline_popup ();
432-
433- $ this ->assertInstanceOf (JsonResponse::class, $ response );
434- $ this ->assertEquals (['success ' => true ], json_decode ($ response ->getContent (), true ));
435-
436- $ sql = 'SELECT user_wpn_popup_declined FROM phpbb_users WHERE user_id = 2 ' ;
437- $ result = $ this ->db ->sql_query ($ sql );
438- $ declined = $ this ->db ->sql_fetchfield ('user_wpn_popup_declined ' );
439- $ this ->db ->sql_freeresult ($ result );
440-
441- $ this ->assertEquals (1 , $ declined );
442- }
443-
444- public function test_subscribe_clears_declined_status ()
445- {
446- $ this ->form_helper ->method ('check_form_tokens ' )->willReturn (true );
447- $ this ->request ->method ('is_ajax ' )->willReturn (true );
448- $ this ->user ->data ['user_id ' ] = 2 ;
449- $ this ->user ->data ['is_bot ' ] = false ;
450- $ this ->user ->data ['user_type ' ] = USER_NORMAL ;
451-
452- // First decline
453- $ this ->controller ->decline_popup ();
454-
455- $ sql = 'SELECT user_wpn_popup_declined FROM phpbb_users WHERE user_id = 2 ' ;
456- $ result = $ this ->db ->sql_query ($ sql );
457- $ declined = $ this ->db ->sql_fetchfield ('user_wpn_popup_declined ' );
458- $ this ->db ->sql_freeresult ($ result );
459- $ this ->assertEquals (1 , $ declined );
460-
461- // Then subscribe
462- $ symfony_request = $ this ->createMock (\phpbb \symfony_request::class);
463- $ symfony_request ->method ('get ' )->willReturn (json_encode ([
464- 'endpoint ' => 'test_endpoint ' ,
465- 'expiration_time ' => 0 ,
466- 'keys ' => ['p256dh ' => 'test_p256dh ' , 'auth ' => 'test_auth ' ]
467- ]));
468-
469- $ this ->controller ->subscribe ($ symfony_request );
470-
471- // Check declined status is cleared
472- $ sql = 'SELECT user_wpn_popup_declined FROM phpbb_users WHERE user_id = 2 ' ;
473- $ result = $ this ->db ->sql_query ($ sql );
474- $ declined = $ this ->db ->sql_fetchfield ('user_wpn_popup_declined ' );
475- $ this ->db ->sql_freeresult ($ result );
476- $ this ->assertEquals (0 , $ declined );
477- }
478-
479423 private function get_subscription_data ()
480424 {
481425 $ sql = 'SELECT *
0 commit comments