@@ -507,11 +507,13 @@ public function test_export_data_with_migration(): void
507
507
$ migration_class = '\phpbb\webpushnotifications\migrations\handle_subscriptions ' ;
508
508
$ migrator ->populate_migrations ([$ migration_class ]);
509
509
510
+ // Revert migration data
510
511
while ($ migrator ->migration_state ($ migration_class ) !== false )
511
512
{
512
513
$ migrator ->revert ($ migration_class );
513
514
}
514
515
516
+ // Test reverting data results
515
517
$ sql = 'SELECT config_name, config_value FROM ' . CONFIG_TABLE . "
516
518
WHERE config_name IN('webpush_enable', 'webpush_vapid_public', 'webpush_vapid_private') " ;
517
519
$ result = $ this ->db ->sql_query ($ sql );
@@ -527,5 +529,27 @@ public function test_export_data_with_migration(): void
527
529
$ this ->assertEquals ($ this ->config ['wpn_webpush_enable ' ], $ exported_config_data ['webpush_enable ' ]);
528
530
$ this ->assertEquals ($ this ->config ['wpn_webpush_vapid_public ' ], $ exported_config_data ['webpush_vapid_public ' ]);
529
531
$ this ->assertEquals ($ this ->config ['wpn_webpush_vapid_private ' ], $ exported_config_data ['webpush_vapid_private ' ]);
532
+
533
+ $ sql = "SELECT * FROM phpbb_user_notifications
534
+ WHERE method = ' " . $ this ->db ->sql_escape ('notification.method.webpush ' ) . "' " ;
535
+ $ result = $ this ->db ->sql_query ($ sql );
536
+ $ this ->assertGreaterThan (0 , count ($ this ->db ->sql_fetchrowset ($ result )));
537
+ $ this ->db ->sql_freeresult ($ result );
538
+
539
+ $ sql = "SELECT * FROM phpbb_user_notifications
540
+ WHERE method = ' " . $ this ->db ->sql_escape ('notification.method.phpbb.wpn.webpush ' ) . "' " ;
541
+ $ result = $ this ->db ->sql_query ($ sql );
542
+ $ this ->assertEquals (0 , count ($ this ->db ->sql_fetchrowset ($ result )));
543
+ $ this ->db ->sql_freeresult ($ result );
544
+
545
+ $ this ->assertEquals (
546
+ $ this ->db ->sql_fetchrowset ($ this ->db ->sql_query ('SELECT * FROM phpbb_wpn_notification_push ' )),
547
+ $ this ->db ->sql_fetchrowset ($ this ->db ->sql_query ('SELECT * FROM phpbb_notification_push ' ))
548
+ );
549
+
550
+ $ this ->assertEquals (
551
+ $ this ->db ->sql_fetchrowset ($ this ->db ->sql_query ('SELECT * FROM phpbb_wpn_push_subscriptions ' )),
552
+ $ this ->db ->sql_fetchrowset ($ this ->db ->sql_query ('SELECT * FROM phpbb_push_subscriptions ' ))
553
+ );
530
554
}
531
555
}
0 commit comments