public function deactivation() { $classname = get_class($this); // echo "Deactivating $classname";die; do_action("AHEE__{$classname}__deactivation"); do_action("AHEE__EE_Addon__deactivation", $this); //check if the site no longer needs to be in maintenance mode EE_Register_Addon::deregister($this->name()); EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); }
public function tearDown() { if (isset($this->_addon_name) && isset(EE_Registry::instance()->addons->EE_New_Addon)) { $main_file_path_before_deregistration = EE_Registry::instance()->addons->EE_New_Addon->get_main_plugin_file_basename(); EE_Register_Addon::deregister($this->_addon_name); try { EE_Registry::instance()->addons->EE_New_Addon; $this->fail('EE_New_Addon is still registered. Deregister failed'); } catch (PHPUnit_Framework_Error_Notice $e) { $this->assertEquals(EE_UnitTestCase::error_code_undefined_property, $e->getCode()); } //verify the deactvation hook was removed $this->assertFalse(has_action('deactivate_' . $main_file_path_before_deregistration)); //verify the models were deregistered EE_System::instance()->load_core_configuration(); $this->assertArrayDoesNotContain('EEM_New_Addon_Thing', EE_Registry::instance()->non_abstract_db_models); $this->assertArrayDoesNotContain('EEM_New_Addon_Thing', EE_Registry::instance()->models); EE_Registry::instance()->reset_model('Attendee'); //verify that the model and class extensions have been removed $this->assertFalse($this->_class_has_been_extended()); $this->assertFalse($this->_model_has_been_extended()); } //verify DMSs deregistered $DMSs_available = EE_Data_Migration_Manager::reset()->get_all_data_migration_scripts_available(); $this->assertArrayNotHasKey('EE_DMS_New_Addon_1_0_0', $DMSs_available); $this->_stop_pretending_addon_hook_time(); $this->_stop_pretending_after_plugin_activation(); remove_all_filters('AHEE__EE_System__load_espresso_addons'); parent::tearDown(); }
public function tearDown() { //if somehow $this->_addon isn't set, we don't need to worry about deregistering it right? if ($this->_addon instanceof EE_Addon) { update_option($this->_addon->get_activation_history_option_name(), $this->_addon_activation_history); update_option(EE_Data_Migration_Manager::current_database_state, $this->_current_db_state); EE_Register_Addon::deregister($this->_addon_name); try { EE_Registry::instance()->addons->EE_New_Addon; $this->fail('EE_New_Addon is still registered. Deregister failed'); } catch (PHPUnit_Framework_Error_Notice $e) { $this->assertEquals(EE_UnitTestCase::error_code_undefined_property, $e->getCode()); } //verify DMSs deregistered $DMSs_available = EE_Data_Migration_Manager::reset()->get_all_data_migration_scripts_available(); $this->assertArrayNotHasKey('EE_DMS_New_Addon_1_0_0', $DMSs_available); $this->_stop_pretending_addon_hook_time(); } parent::tearDown(); }