wp_footer hook running twice

That code doesn’t look like it conforms to the current Widgets API. Perhaps your problem is related?

First potential issue: your class test should be plugin-slug-test, in order to avoid naming conflicts.

Second potential issue: the only functions inside of your WP_Widget extending class should be:

  • function plugin-slug-test() {}
  • function widget( $args, $instance ) {}
  • function update( $new_instance, $old_instance ) {}
  • function form( $instance ) {}

You need to move your add_action() calls outside of your Widget class.

Third potential issue: why do you declare all of your Widget class functions to be public?

Fourth potential issue: I don’t think you need to declare new Test(); for a Widget class.