public function setUp()
 {
     //for the testing's sake, we want events to be related to paymetn methods via a HABTM_Any relation
     add_filter('FHEE__EEM_Event__construct__model_relations', array($this, 'relate_events_to_payment_methods'));
     add_filter('FHEE__EEM_Payment_Method__construct__model_relations', array($this, 'relate_payment_methods_to_events'));
     parent::setUp();
 }
 public function setUp()
 {
     parent::setUp();
     //make sure caf payment methods are registered
     new EE_Brewing_Regular();
     EE_Payment_Method_Manager::reset();
 }
 public function setUp()
 {
     parent::setUp();
     $this->event_term = $this->new_model_obj_with_dependencies('Term');
     $this->new_model_obj_with_dependencies('Term_Taxonomy', array('term_id' => $this->event_term->ID(), 'taxonomy' => 'espresso_event_categories'));
     $this->venue_term = $this->new_model_obj_with_dependencies('Term');
     $this->new_model_obj_with_dependencies('Term_Taxonomy', array('term_id' => $this->venue_term->ID(), 'taxonomy' => 'espresso_venue_categories'));
 }
 function tearDown()
 {
     global $wp_filesystem;
     remove_filter('filesystem_method_file', array($this, 'filter_abstraction_file'));
     remove_filter('filesystem_method', array($this, 'filter_fs_method'));
     unset($wp_filesystem);
     parent::tearDown();
 }
 public function setUp()
 {
     parent::setUp();
     //clean out hte WP User table for these tests
     EEM_WP_User::instance()->delete(array(), false);
     $this->me = $this->factory->user->create_and_get();
     $this->somebody_else = $this->factory->user->create_and_get();
 }
 public function setUp()
 {
     parent::setUp();
     $this->_validator = new EE_Text_Validation_Strategy('oups', '~Darth ([\\w]*)~');
     $input = new EE_Text_Input();
     //finalize its construction, but we don't actually need the input anyways
     $this->_validator->_construct_finalize($input);
 }
 static function setUpBeforeClass()
 {
     //		EE_Registry::instance()->load_helper('Activation');
     //		EEH_Activation::create_table('esp_mock',
     //				"MCK_ID int(11) NOT NULL,
     //				PRIMARY KEY  (MCK_ID)");
     //		require_once(EE_TESTS_DIR.'mocks/core/db_models/EEM_Mock.model.php');
     //		require_once(EE_TESTS_DIR.'mocks/core/db_classes/EE_Mock.class.php');
     parent::setUpBeforeClass();
 }
 /**
  * used to set the admin page mock
  */
 public function setUp()
 {
     parent::setUp();
     $this->loadAdminMocks();
     $this->_eeAdminMock = new Admin_Mock_Valid_Admin_Page(false);
     $this->_testRoute = admin_url('admin.php?page=mock_valid_admin_page');
     //go to mock_valid_admin_page route for test
     $this->go_to($this->_testRoute);
     $this->defineAdminConstants();
     $this->_eeAdminHookMock = new mock_valid_admin_page_Admin_Mock_Valid_Hooks($this->_eeAdminMock);
 }
 public function setUp()
 {
     parent::setUp();
     require_once EE_TESTS_DIR . 'mocks/core/Psr4AutoloaderMock.php';
     $this->loader = new Psr4AutoloaderMock();
     $this->loader->setFiles(array('/vendor/foo.bar/src/ClassName.php', '/vendor/foo.bar/src/DoomClassName.php', '/vendor/foo.bar/tests/ClassNameTest.php', '/vendor/foo.bardoom/src/ClassName.php', '/vendor/foo.bar.baz.dib/src/ClassName.php', '/vendor/foo.bar.baz.dib.zim.gir/src/ClassName.php'));
     $this->loader->addNamespace('Foo\\Bar', '/vendor/foo.bar/src');
     $this->loader->addNamespace('Foo\\Bar', '/vendor/foo.bar/tests');
     $this->loader->addNamespace('Foo\\BarDoom', '/vendor/foo.bardoom/src');
     $this->loader->addNamespace('Foo\\Bar\\Baz\\Dib', '/vendor/foo.bar.baz.dib/src');
     $this->loader->addNamespace('Foo\\Bar\\Baz\\Dib\\Zim\\Gir', '/vendor/foo.bar.baz.dib.zim.gir/src');
 }
 /**
  * setUp
  */
 public function setUp()
 {
     $return_value = parent::setUp();
     //EEG_Paypal_Pro uses $_SERVER at some point, so we need to pretend this is a regular request
     $this->go_to('http://localhost/');
     //just set a random address
     $_SERVER['REMOTE_ADDR'] = '192.0.0.1';
     add_filter('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', '__return_false');
     //make sure caf payment methods are registered
     new EE_Brewing_Regular();
     EE_Payment_Method_Manager::reset();
     return $return_value;
 }
 public function setUp()
 {
     parent::setUp();
     $this->user = $this->factory->user->create_and_get();
     $this->my_event = $this->new_model_obj_with_dependencies('Event', array('EVT_wp_user' => $this->user->ID));
     $term_id_and_taxonomy_id = wp_insert_term('term_r_for_my_event', 'espresso_event_categories');
     $result = wp_set_object_terms($this->my_event->ID(), $term_id_and_taxonomy_id['term_id'], 'espresso_event_categories');
     $this->term_r_for_my_event = EEM_Term_Relationship::instance()->get_one(array(array('object_id' => $this->my_event->ID(), 'term_taxonomy_id' => reset($result))));
     $this->others_event = $this->new_model_obj_with_dependencies('Event', array('EVT_wp_user' => $this->user->ID + 1));
     $term_id_and_taxonomy_id = wp_insert_term('term_r_for_others_event', 'espresso_event_categories');
     $result = wp_set_object_terms($this->others_event->ID(), $term_id_and_taxonomy_id['term_id'], 'espresso_event_categories');
     $this->term_r_for_others_event = EEM_Term_Relationship::instance()->get_one(array(array('object_id' => $this->others_event->ID(), 'term_taxonomy_id' => reset($result))));
 }
 public function setUp()
 {
     parent::setUp();
     //let's just make a generic addon, but not bother registering it
     $this->_addon = EE_Registry::instance()->load_addon(dirname($this->_main_file_path), 'EE_New_Addon');
     $this->_addon->set_name('New_Addon');
     $this->_addon->set_main_plugin_file($this->_main_file_path);
     $this->_addon->set_version('1.0.0');
     $this->_addon->set_min_core_version('4.0.0');
     //		$addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] );
     //		$addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] );
     //		$addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] );
     add_filter('FHEE__EEH_Activation__create_table__short_circuit', array($this, 'dont_short_circuit_new_addon_table'), 20, 3);
 }
 public function setUp()
 {
     parent::setUp();
     //all shortcode parse tests will require a full event to be setup with some datetimes and tickets.
     $price = $this->factory->price_chained->create_object(array('PRC_name' => 'Not Free Price', 'PRC_amount' => '125.00'));
     $this->_ticket = $this->factory->ticket_chained->create_object(array('PRC_ID' => $price->ID()));
     //update ticket price
     $this->_ticket->set('TKT_price', '125.00');
     $this->_ticket->set('TKT_name', 'Podracing Entry');
     $this->_ticket->set('TKT_description', 'One entry in the event.');
     $this->_datetime = $this->_ticket->first_datetime();
     $this->_event = $this->_datetime->event();
     //set the author of the event
     $this->_event->set('EVT_wp_user', 1);
 }
 public function setUp()
 {
     parent::setUp();
     //let's make sure we start off with NO tickets in the DB
     EEM_Ticket::instance()->delete_permanently(EEM_Ticket::instance()->alter_query_params_so_deleted_and_undeleted_items_included(), false);
     $this->assertEquals(0, EEM_Ticket::instance()->count(EEM_Ticket::instance()->alter_query_params_so_deleted_and_undeleted_items_included()));
     $this->user = $this->factory->user->create_and_get();
     $this->e_mine = $this->new_model_obj_with_dependencies('Event', array('EVT_wp_user' => $this->user->ID, 'status' => 'publish'));
     $this->e_others = $this->new_model_obj_with_dependencies('Event', array('EVT_wp_user' => 99999, 'status' => 'publish'));
     $this->e_private = $this->new_model_obj_with_dependencies('Event', array('EVT_wp_user' => 99999, 'status' => 'private'));
     $this->t_mine = $this->new_model_obj_with_dependencies('Ticket', array('TKT_is_default' => false, 'TKT_wp_user' => $this->user->ID));
     $this->t_others = $this->new_model_obj_with_dependencies('Ticket', array('TKT_is_default' => false, 'TKT_wp_user' => 9999));
     $this->t_private = $this->new_model_obj_with_dependencies('Ticket', array('TKT_is_default' => false, 'TKT_wp_user' => 9999));
     $this->t_mine_default = $this->new_model_obj_with_dependencies('Ticket', array('TKT_is_default' => true, 'TKT_wp_user' => $this->user->ID));
     $this->t_others_default = $this->new_model_obj_with_dependencies('Ticket', array('TKT_is_default' => true, 'TKT_wp_user' => 9999));
     $dtt_to_mine = $this->new_model_obj_with_dependencies('Datetime', array('EVT_ID' => $this->e_mine->ID()));
     $dtt_to_mine->_add_relation_to($this->t_mine, 'Ticket');
     $dtt_to_others = $this->new_model_obj_with_dependencies('Datetime', array('EVT_ID' => $this->e_others->ID()));
     $dtt_to_others->_add_relation_to($this->t_others, 'Ticket');
     $dtt_to_private = $this->new_model_obj_with_dependencies('Datetime', array('EVT_ID' => $this->e_private->ID()));
     $dtt_to_private->_add_relation_to($this->t_private, 'Ticket');
 }
 public function tearDown()
 {
     //restore the timezone string to the default
     update_option('timezone_string', '');
     parent::tearDown();
 }
 public function __construct($name = NULL, array $data = array(), $dataName = '')
 {
     EE_Registry::instance()->load_helper('Inflector');
     parent::__construct($name, $data, $dataName);
 }
 protected function _pretend_addon_hook_time()
 {
     global $wp_actions;
     unset($wp_actions['AHEE__EEM_Attendee__construct__end']);
     unset($wp_actions['AHEE__EE_System__load_core_configuration__begin']);
     unset($wp_actions['AHEE__EE_System__register_shortcodes_modules_and_widgets']);
     unset($wp_actions['AHEE__EE_System__core_loaded_and_ready']);
     parent::_pretend_addon_hook_time();
 }
 public function setUp()
 {
     require_once EE_TESTS_DIR . 'mocks/EE_Repository_Mock.php';
     $this->repository = new EE_Repository_Mock();
     parent::setUp();
 }
 public function setUp()
 {
     parent::setUp();
     $this->loadModelFieldMocks(array('EE_Datetime_Field'));
 }
 public function setUp()
 {
     parent::setUp();
     $this->loadAdminMocks();
 }
 public function tearDown()
 {
     EE_Register_Capabilities::deregister('Test_Capabilities');
     parent::tearDown();
 }
 /**
  * Detects whether or not a MYSQL query was issued which caused an implicit commit
  * (or an explicit one). Basically, we can't do a commit mid-test because it messes
  * up the test's state (which means the database state at the time of the commit will
  * become the new starting state for all future tests, which will likely cause hard-to-find
  * bugs, and makes test results dependent on order of execution)
  * @global WPDB $wpdb
  * @throws EE_Error
  */
 protected function _detect_accidental_txn_commit()
 {
     //for some reason WP waits until the start of the next test to do this. but
     //we prefer to do it now so that we can check for implicit commits
     $this->clean_up_global_scope();
     //now we can check if there was an accidental implicit commit
     if (!self::$accidental_txn_commit_noted && get_option('accidental_txn_commit_indicator', FALSE)) {
         global $wpdb;
         self::$accidental_txn_commit_noted = TRUE;
         throw new EE_Error(sprintf(__("Accidental MySQL Commit was issued sometime during the previous test. This means we couldn't properly restore database to its pre-test state. If this doesnt create problems now it probably will later! Read up on MySQL commits, especially Implicit Commits. Queries executed were: \r\n%s. \r\nThis accidental commit happened during %s", 'event_espresso'), print_r($wpdb->queries, TRUE), $this->getName()));
     }
 }
 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();
 }
 public function tearDown()
 {
     EE_Register_Payment_Method::deregister('onsite');
     EE_Register_Payment_Method::deregister('offsite');
     parent::tearDown();
 }
 public function setUp()
 {
     parent::setUp();
     $this->delayedAdminPageMocks('registrations');
 }
 /**
  * restore the epsresso_db_update option
  */
 function tearDown()
 {
     update_option('espresso_db_update', $this->_original_espresso_db_update);
     EE_System::reset()->detect_req_type();
     EE_Data_Migration_Manager::reset();
     update_option(EE_Data_Migration_Manager::current_database_state, $this->_original_db_state);
     parent::tearDown();
 }
 public function tearDown()
 {
     //ensure the models aren't stil registered. they should have either been
     //deregistered during the test, or not been registered at all
     $this->assertArrayDoesNotContain('EEM_Mock', EE_Registry::instance()->non_abstract_db_models);
     $this->assertArrayDoesNotContain('EEM_Mock', EE_Registry::instance()->models);
     $this->_stop_pretending_addon_hook_time();
     parent::tearDown();
 }
 public function __construct($name = NULL, array $data = array(), $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     $this->_pmt_args = array('payment_method_paths' => array(EE_TESTS_DIR . 'mocks' . DS . 'payment_methods' . DS . 'Mock_Onsite'));
     EE_Registry::instance()->load_lib('Payment_Method_Manager');
 }
 function setUp()
 {
     parent::setUp();
     EEH_Autoloader::register_line_item_filter_autoloaders();
 }
 public function setUp()
 {
     parent::setUp();
     EE_Cart::reset();
 }