function test_register_mock_addon_success()
 {
     $this->_pretend_addon_hook_time();
     $this->assertArrayDoesNotContain('EEM_Mock', EE_Registry::instance()->non_abstract_db_models);
     $this->assertArrayDoesNotContain('EEM_Mock', EE_Registry::instance()->models);
     //register it for realz
     EE_Register_Model::register($this->_model_group, $this->_reg_args);
     EE_System::instance()->load_core_configuration();
     $this->assertArrayContains('EEM_Mock', EE_Registry::instance()->non_abstract_db_models);
     $this->assertArrayContains('EEM_Mock', EE_Registry::instance()->models);
     //now deregister it
     EE_Register_Model::deregister($this->_model_group);
     EE_System::instance()->load_core_configuration();
     $this->assertArrayDoesNotContain('EEM_Mock', EE_Registry::instance()->non_abstract_db_models);
     $this->assertArrayDoesNotContain('EEM_Mock', EE_Registry::instance()->models);
 }
 /**
  * This deregisters an addon that was previously registered with a specific addon_name.
  *
  * @since    4.3.0
  *
  * @param string $addon_name the name for the addon that was previously registered
  * @throws EE_Error
  * @return void
  */
 public static function deregister($addon_name = NULL)
 {
     if (isset(self::$_settings[$addon_name])) {
         $class_name = self::$_settings[$addon_name]['class_name'];
         if (!empty(self::$_settings[$addon_name]['dms_paths'])) {
             // setup DMS
             EE_Register_Data_Migration_Scripts::deregister($addon_name);
         }
         if (!empty(self::$_settings[$addon_name]['admin_path'])) {
             // register admin page
             EE_Register_Admin_Page::deregister($addon_name);
         }
         if (!empty(self::$_settings[$addon_name]['module_paths'])) {
             // add to list of modules to be registered
             EE_Register_Module::deregister($addon_name);
         }
         if (!empty(self::$_settings[$addon_name]['shortcode_paths'])) {
             // add to list of shortcodes to be registered
             EE_Register_Shortcode::deregister($addon_name);
         }
         if (!empty(self::$_settings[$addon_name]['config_class'])) {
             // if config_class present let's register config.
             EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
         }
         if (!empty(self::$_settings[$addon_name]['widget_paths'])) {
             // add to list of widgets to be registered
             EE_Register_Widget::deregister($addon_name);
         }
         if (!empty(self::$_settings[$addon_name]['model_paths']) || !empty(self::$_settings[$addon_name]['class_paths'])) {
             // add to list of shortcodes to be registered
             EE_Register_Model::deregister($addon_name);
         }
         if (!empty(self::$_settings[$addon_name]['model_extension_paths']) || !empty(self::$_settings[$addon_name]['class_extension_paths'])) {
             // add to list of shortcodes to be registered
             EE_Register_Model_Extensions::deregister($addon_name);
         }
         if (!empty(self::$_settings[$addon_name]['message_types'])) {
             foreach (self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
                 EE_Register_Message_Type::deregister($message_type);
             }
         }
         //deregister capabilities for addon
         if (!empty(self::$_settings[$addon_name]['capabilities']) || !empty(self::$_settings[$addon_name]['capability_maps'])) {
             EE_Register_Capabilities::deregister($addon_name);
         }
         //deregister custom_post_types for addon
         if (!empty(self::$_settings[$addon_name]['custom_post_types'])) {
             EE_Register_CPT::deregister($addon_name);
         }
         remove_action('deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(), array(EE_Registry::instance()->addons->{$class_name}, 'deactivation'));
         remove_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required'));
         unset(EE_Registry::instance()->addons->{$class_name});
         unset(self::$_settings[$addon_name]);
     }
 }