function test_callSetsTransactionTypeWithObject() { XmlSerializer::$sort = true; Config::setLogger(new StdoutLogger()); $curl = $this->curlMock(); $requestXml = $this->schemaRequest('sale.xml'); $responseXml = $this->schemaResponse('sale.xml'); $curl->shouldReceive('xmlPost')->with('https://test.hypercharge.net/process/CHANNEL_TOKEN', $requestXml)->once()->andReturn($responseXml); $data = $this->schemaRequest('sale.json'); $request = new TransactionRequest($data['payment_transaction']); $request->transaction_type = 'foobar'; $_call = new \ReflectionMethod('Hypercharge\\Transaction', '_call'); $_call->setAccessible(true); $_call->invoke(null, 'sale', $request, 'CHANNEL_TOKEN'); }
<?php namespace Hypercharge; require_once dirname(__DIR__) . '/test_helper.php'; use Mockery as m; if (getenv('DEBUG') == '1') { Config::setLogger(new StdoutLogger()); } class PaymentIntegrationTest extends HyperchargeTestCase { function setUp() { $this->credentials(); Config::setIdSeparator('---'); $this->expected_payment_methods = array("barzahlen", "credit_card", "direct_debit", "direct_pay24_sale", "giro_pay_sale", "ideal_sale", "pay_in_advance", "pay_pal", "pay_safe_card_sale", "payment_on_delivery", "purchase_on_account", "sepa_direct_debit"); sort($this->expected_payment_methods); } function tearDown() { m::close(); Config::setFactory(new Factory()); } function testWrongPwd() { $this->expectException(new Errors\NetworkError($this->credentials->paymentHost . '/payment', 401, 'The requested URL returned error: 401')); Config::set($this->credentials->user, 'wrong password', Config::ENV_SANDBOX); $data = $this->fixture('wpf_payment_request_simple.json'); $payment = Payment::wpf($data); } function testCrapyData()