setUp() public method

Setup test case.
Since: 1.0
public setUp ( )
Esempio n. 1
0
 /**
  * Set it Up
  */
 public function setUp()
 {
     parent::setUp();
     $this->_object = new Give_Logging();
     $this->_object->register_post_type();
     $this->_object->register_taxonomy();
 }
Esempio n. 2
0
 /**
  * Set it up
  */
 public function setUp()
 {
     parent::setUp();
     //Create a Donation Form
     $this->_post_id = $this->factory->post->create(array('post_title' => 'Test Form', 'post_type' => 'give_forms', 'post_status' => 'publish'));
     $_multi_level_donations = array(array('_give_id' => array('level_id' => '1'), '_give_amount' => '10.00', '_give_text' => 'Basic Level'), array('_give_id' => array('level_id' => '2'), '_give_amount' => '20.00', '_give_text' => 'Intermediate Level'), array('_give_id' => array('level_id' => '3'), '_give_amount' => '40.00', '_give_text' => 'Advanced Level'));
     $meta = array('give_price' => '0.00', '_give_price_option' => 'multi', '_give_price_options_mode' => 'on', '_give_donation_levels' => array_values($_multi_level_donations), 'give_product_notes' => 'Donation Notes', '_give_product_type' => 'default');
     foreach ($meta as $key => $value) {
         update_post_meta($this->_post_id, $key, $value);
     }
     //Generate Donations
     $this->_user_id = $this->factory->user->create(array('role' => 'administrator'));
     $user = get_userdata($this->_user_id);
     $user_info = array('id' => $user->ID, 'email' => '*****@*****.**', 'first_name' => $user->first_name, 'last_name' => $user->last_name);
     $donation_details = array(array('id' => $this->_post_id, 'options' => array('price_id' => 1)));
     $total = 0;
     $prices = get_post_meta($donation_details[0]['id'], '_give_donation_levels', true);
     $item_price = $prices[1]['_give_amount'];
     $total += $item_price;
     $purchase_data = array('price' => number_format((double) $total, 2), 'give_form_title' => get_the_title($this->_post_id), 'give_form_id' => $this->_post_id, 'date' => date('Y-m-d H:i:s', strtotime('-1 day')), 'purchase_key' => strtolower(md5(uniqid())), 'user_email' => $user_info['email'], 'user_info' => $user_info, 'currency' => 'USD', 'status' => 'pending', 'gateway' => 'manual');
     $_SERVER['REMOTE_ADDR'] = '10.0.0.0';
     $_SERVER['SERVER_NAME'] = 'give_virtual';
     $payment_id = give_insert_payment($purchase_data);
     give_update_payment_status($payment_id, 'complete');
 }
Esempio n. 3
0
 public function setUp()
 {
     parent::setUp();
     $this->_roles = new Give_Roles();
     $this->_roles->add_roles();
     $this->_roles->add_caps();
 }
Esempio n. 4
0
 public function setUp()
 {
     parent::setUp();
     give_set_error('invalid_email', 'Please enter a valid email address.');
     give_set_error('invalid_user', 'The user information is invalid.');
     give_set_error('username_incorrect', 'The username you entered does not exist.');
     give_set_error('password_incorrect', 'The password you entered is incorrect.');
 }
Esempio n. 5
0
 public function setUp()
 {
     parent::setUp();
     global $wp_rewrite, $wp_query;
     $GLOBALS['wp_rewrite']->init();
     flush_rewrite_rules(false);
     $this->_api = new Give_API();
     $roles = new Give_Roles();
     $roles->add_roles();
     $roles->add_caps();
     $this->_api->add_endpoint($wp_rewrite);
     $this->_rewrite = $wp_rewrite;
     $this->_query = $wp_query;
     //Create a Donation Form
     $post_id = $this->factory->post->create(array('post_title' => 'Test Form', 'post_type' => 'give_forms', 'post_status' => 'publish'));
     $this->_user_id = $this->factory->user->create(array('role' => 'administrator'));
     wp_set_current_user($this->_user_id);
     $_multi_level_donations = array(array('_give_id' => array('level_id' => '1'), '_give_amount' => '10.00', '_give_text' => 'Basic Level'), array('_give_id' => array('level_id' => '2'), '_give_amount' => '20.00', '_give_text' => 'Intermediate Level'), array('_give_id' => array('level_id' => '3'), '_give_amount' => '40.00', '_give_text' => 'Advanced Level'));
     $meta = array('give_price' => '0.00', '_give_price_option' => 'multi', '_give_price_options_mode' => 'on', '_give_donation_levels' => array_values($_multi_level_donations), '_give_form_earnings' => 120, '_give_form_sales' => 59);
     foreach ($meta as $key => $value) {
         update_post_meta($post_id, $key, $value);
     }
     $this->_post = get_post($post_id);
     $user = get_userdata(1);
     $user_info = array('id' => $user->ID, 'email' => '*****@*****.**', 'first_name' => $user->first_name, 'last_name' => $user->last_name);
     $prices = get_post_meta($post_id, '_give_donation_levels', true);
     $total = $prices[1]['_give_amount'];
     //Add a payment
     $purchase_data = array('price' => number_format((double) $total, 2), 'give_form_title' => get_the_title($post_id), 'give_form_id' => $post_id, 'date' => date('Y-m-d H:i:s', strtotime('-1 day')), 'purchase_key' => strtolower(md5(uniqid())), 'user_email' => $user_info['email'], 'user_info' => $user_info, 'currency' => 'USD', 'status' => 'pending', 'gateway' => 'manual');
     $_SERVER['REMOTE_ADDR'] = '10.0.0.0';
     $this->_payment_id = give_insert_payment($purchase_data);
     give_update_payment_status($this->_payment_id, 'complete');
     $this->_api_output = $this->_api->get_forms();
     $this->_api_output_sales = $this->_api->get_recent_donations();
     global $wp_query;
     $wp_query->query_vars['format'] = 'override';
 }
Esempio n. 6
0
 public function setUp()
 {
     parent::setUp();
 }
Esempio n. 7
0
 public function setUp()
 {
     parent::setUp();
     wp_set_current_user(0);
 }
Esempio n. 8
0
 public function setUp()
 {
     parent::setUp();
     $this->_post = Give_Helper_Form::create_multilevel_form();
 }
Esempio n. 9
0
 public function setUp()
 {
     parent::setUp();
     $this->object = Give();
 }
Esempio n. 10
0
 /**
  * Set it Up
  */
 public function setUp()
 {
     parent::setUp();
     new \Give_Session();
 }