Created
October 7, 2014 04:23
-
-
Save cklosowski/dfacf077497515c72334 to your computer and use it in GitHub Desktop.
Update Payment Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function test_update_payment_amount() { | |
$pre_update_total_earnings = get_option( 'edd_earnings_total' ); | |
$pre_update_payment_amount = edd_sanitize_amount( edd_get_payment_amount( $this->_payment_id ) ); | |
$payment_download = array( | |
'id' => $this->_post->ID, | |
'price_id' => '1', | |
'amount' => '100', | |
'quantity' => '1' | |
); | |
$user = get_userdata(1); | |
$payment_address = array( | |
'line1' => '', | |
'line2' => '', | |
'city' => '', | |
'zip' => '', | |
'country' => '0', | |
'state' => '' | |
); | |
$data = array( | |
'edd_action' => 'update_payment_details', | |
'edd_payment_id' => $this->_payment_id, | |
'edd-payment-note' => '', | |
'edd-payment-downloads-changed' => '', | |
'edd-order-download-amount' => '', | |
'edd-order-download-select' => '', | |
'edd-payment-details-downloads' => array( $payment_download ), | |
'edd-payment-address' => array( $payment_address ), | |
'edd-payment-user-id' => '1', | |
'edd-payment-user-email' => $user->user_email, | |
'edd-payment-user-name' => $user->first_name . ' ' . $user->last_name, | |
'edd-payment-time-min' => '', | |
'edd-payment-time-hour' => '', | |
'edd-payment-date' => '', | |
'edd-payment-status' => 'publish', | |
'edd-payment-total' => '50' | |
); | |
$_POST['edd-payment-total'] = '50'; | |
$_POST['edd-payment-tax'] = '0'; | |
do_action( 'edd_update_payment_details', $data ); | |
$post_update_total_earnings = get_option( 'edd_earnings_total' ); | |
$new_total_earnings = $pre_update_total_earnings - $pre_update_payment_amount + $_POST['edd-payment-total']; | |
$this->assertEquals( $post_update_total_earnings, $new_total_earnings ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment