current(); self::assertSame( 'success', $notices[0]->type() ); self::assertSame( 'The package JSON file was imported successfully.', $notices[0]->message() ); } public function test_it_sanitizes_error_notices(): void { $_GET['wpcs_import_error'] = ''; $notices = ( new AdminNoticeRepository() )->current(); self::assertSame( 'error', $notices[0]->type() ); self::assertSame( 'Bad package', $notices[0]->message() ); } public function test_it_builds_settings_connection_logs_and_export_notices(): void { $_GET['wpcs_settings_saved'] = '1'; $_GET['wpcs_connection_ok'] = '1'; $_GET['wpcs_logs_cleared'] = '1'; $_GET['wpcs_connection_error'] = 'REST authentication failed.'; $_GET['wpcs_export_error'] = 'Export failed.'; $notices = ( new AdminNoticeRepository() )->current(); self::assertSame( 'Settings saved.', $notices[0]->message() ); self::assertSame( 'REST connection succeeded.', $notices[1]->message() ); self::assertSame( 'Logs cleared.', $notices[2]->message() ); self::assertSame( 'REST authentication failed.', $notices[3]->message() ); self::assertSame( 'Export failed.', $notices[4]->message() ); } }