public function __construct() { //setting this SUPER late because EventSmart runs it's deregisters later as well. This ensures that we are //running this hook well after any other plugins have possibly deregistered the addon. add_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin', array($this, 'load_early_hooks_when_registered'), 1000); parent::__construct(); }
/** * Setup default data for the addon. * * @access public * @return void */ public function initialize_default_data() { parent::initialize_default_data(); // Update the currencies supported by this gateway (if changed). $payflow = EEM_Payment_method::instance()->get_one_of_type('Payflow_Pro_Onsite'); // Update If the payment method already exists. if ($payflow) { $currencies = $payflow->get_all_usable_currencies(); $all_related = $payflow->get_many_related('Currency'); if ($currencies != $all_related) { $payflow->_remove_relations('Currency'); foreach ($currencies as $currency_obj) { $payflow->_add_relation_to($currency_obj, 'Currency'); } } } }
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(); }