コード例 #1
0
 public function setUp()
 {
     //save the hooks state before WP_UnitTestCase actually gets its hands on it...
     //as it immediately adds a few hooks we might not want to backup
     global $auto_made_thing_seed, $wp_filter, $wp_actions, $merged_filters, $wp_current_filter, $wpdb, $current_user;
     $this->wp_filters_saved = array('wp_filter' => $wp_filter, 'wp_actions' => $wp_actions, 'merged_filters' => $merged_filters, 'wp_current_filter' => $wp_current_filter);
     $this->_orig_current_user = clone $current_user;
     parent::setUp();
     EE_Registry::reset(TRUE);
     $auto_made_thing_seed = 1;
     //reset wpdb's list of queries executed so it only stores those from the current test
     $wpdb->queries = array();
     //the accidental txn commit indicator option shouldn't be set from the previous test
     update_option('accidental_txn_commit_indicator', TRUE);
     //		$this->wp_actions_saved = $wp_actions;
     // Fake WP mail globals, to avoid errors
     add_filter('wp_mail', array($this, 'setUp_wp_mail'));
     add_filter('wp_mail_from', array($this, 'tearDown_wp_mail'));
     add_filter('FHEE__EEH_Activation__create_table__short_circuit', '__return_true');
     add_filter('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', '__return_true');
     add_filter('FHEE__EEH_Activation__drop_index__short_circuit', '__return_true');
     // load factories
     EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_TESTS_DIR . 'includes' . DS . 'factories');
     $this->factory = new EE_UnitTest_Factory();
     // load scenarios
     require_once EE_TESTS_DIR . 'includes/scenarios/EE_Test_Scenario_Classes.php';
     $this->scenarios = new EE_Test_Scenario_Factory($this);
     EE_Registry::reset();
 }
コード例 #2
0
 /**
  * @see https://events.codebasehq.com/projects/event-espresso/tickets/8799
  * @group 8799
  * @since 4.8.8.rc.019
  */
 public function test_default_reg_status()
 {
     //first verify the default reg status on config is pending payment
     $this->assertEquals(EEM_Registration::status_id_pending_payment, EE_Registry::instance()->CFG->registration->default_STS_ID);
     //verify creating default event from the model has that default reg status
     /** @type EE_Event $event */
     $event = EEM_Event::instance()->create_default_object();
     $this->assertEquals(EEM_Registration::status_id_pending_payment, $event->default_registration_status());
     //let's update config in the db to have default reg status of approved
     EE_Registry::instance()->CFG->registration->default_STS_ID = EEM_Registration::status_id_approved;
     EE_Registry::instance()->CFG->update_espresso_config();
     //let's reset for new test
     EEM_Event::reset();
     EE_Registry::reset();
     //k NOW the default reg status in config should be approved
     $this->assertEquals(EEM_Registration::status_id_approved, EE_Registry::instance()->CFG->registration->default_STS_ID);
     //new default event should have approved as the default reg status
     $event = EEM_Event::instance()->create_default_object();
     $this->assertEquals(EEM_Registration::status_id_approved, $event->default_registration_status());
 }