/** * test_build_payment_json_response_for_deleted_payment * @since 4.8 * @group 8620 */ public function test_build_payment_json_response_for_deleted_payment() { $this->_admin_page = new Transactions_Admin_Page_Mock(); $this->_setup_standard_transaction_and_payment(40.0, 4, 15.0); // need to make sure relation is set between payment and payment method $this->_payment->_add_relation_to($this->_payment_method(), 'Payment_Method'); $registrations = $this->_get_x_number_of_registrations_from_transaction($this->_transaction, 1); $this->_apply_payment_to_registrations($registrations); $json_response_data = $this->_admin_page->build_payment_json_response($this->_payment, array(), true); $this->assertEquals($this->_payment->ID(), $json_response_data['PAY_ID']); $this->assertEquals(15.0, $json_response_data['amount']); // total paid is still zero, because we haven't actually updated the TXN with the payment info $this->assertEquals(0, $json_response_data['total_paid']); $this->assertEquals(EEM_Transaction::incomplete_status_code, $json_response_data['txn_status']); $this->assertEquals(EEM_Payment::status_id_approved, $json_response_data['pay_status']); $this->assertTrue($json_response_data['delete_txn_reg_status_change']); // will validate $json_response_data[ 'registrations' ] in test_registration_payment_data_array() }