mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-22 04:53:46 +09:00
90 lines
2.3 KiB
PHP
90 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* @group Core
|
|
*/
|
|
class Api_Guest_InvoiceTest extends BBDbApiTestCase
|
|
{
|
|
protected $_initialSeedFile = 'transactions.xml';
|
|
|
|
public function testGateways()
|
|
{
|
|
$data = array(
|
|
'hash' => 'hash',
|
|
);
|
|
$array = $this->api_guest->invoice_get($data);
|
|
$this->assertInternalType('array', $array);
|
|
|
|
$array = $this->api_guest->invoice_gateways();
|
|
$this->assertInternalType('array', $array);
|
|
}
|
|
|
|
|
|
public static function gateways(){
|
|
return array(
|
|
array(1, 1),
|
|
array(2, 2),
|
|
array(2, 3),
|
|
array(2, 4),
|
|
array(3, 1),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider gateways
|
|
*/
|
|
public function testPayment($id, $iid)
|
|
{
|
|
$pf = $this->di['db']->findOne('Invoice', $iid);
|
|
$hash = $pf->hash;
|
|
|
|
$data = array(
|
|
'subscription' => false,
|
|
'hash' => $hash,
|
|
'gateway_id' => $id,
|
|
);
|
|
$array = $this->api_guest->invoice_payment($data);
|
|
$this->assertInternalType('array', $array);
|
|
}
|
|
|
|
public function testNewPayment()
|
|
{
|
|
$gateway_id = 3;
|
|
|
|
$pf = $this->di['db']->findOne('Invoice', 1);
|
|
$hash = $pf->hash;
|
|
|
|
$data = array(
|
|
'subscription' => false,
|
|
'hash' => $hash,
|
|
'gateway_id' => $gateway_id,
|
|
);
|
|
$form = $this->api_guest->invoice_payment($data);
|
|
$this->assertInternalType('array', $form);
|
|
$this->assertEquals('html', $form['type']);
|
|
$this->assertFalse(empty($form['result']));
|
|
|
|
//subscription
|
|
$pf = $this->di['db']->findOne('Invoice', 2);
|
|
$hash = $pf->hash;
|
|
$data = array(
|
|
'subscription' => true,
|
|
'hash' => $hash,
|
|
'gateway_id' => $gateway_id,
|
|
);
|
|
$form2 = $this->api_guest->invoice_payment($data);
|
|
$this->assertInternalType('array', $form2);
|
|
$this->assertEquals('html', $form2['type']);
|
|
$this->assertFalse(empty($form2['result']));
|
|
}
|
|
|
|
public function testupdate()
|
|
{
|
|
$data = array(
|
|
'hash' => 'hash'
|
|
);
|
|
|
|
$bool = $this->api_guest->invoice_update($data);
|
|
$this->assertTrue($bool);
|
|
}
|
|
|
|
} |