public function setUp() { parent::setUp(); $order = new Order(); $order->create(array('user_id' => 1, 'item' => 'New Lamp2', 'sum' => 543.21, 'tel' => '+7123', 'comment' => 'without', 'status' => 'new', 'lifetime' => date('Y-m-d H:i:s', time() + 3600 * 24 * 3))); $this->mock = Mockery::mock('FintechFab\\QiwiSdk\\Curl'); }
public function setUp() { parent::setUp(); Order::truncate(); $order = new Order(); $order->create(array('user_id' => 1, 'item' => 'New Lamp', 'sum' => 150, 'tel' => '+12345', 'comment' => '', 'status' => 'payable', 'lifetime' => date('Y-m-d H:i:s', time()))); }
/** * Получить новый счёт * * @return void */ public function testGetBillSuccess() { App::bind('FintechFab\\QiwiSdk\\Curl', function () { $bill = array('user' => 'tel:+7123', 'amount' => 543.21, 'ccy' => 'RUB', 'comment' => 'without', 'lifetime' => date('Y-m-d\\TH:i:s', time() + 3600 * 24 * 3), 'prv_name' => Gateway::getConfig('provider.name')); $args = array(1, 'PUT', $bill); $this->mock->shouldReceive('request')->withArgs($args)->andReturn((object) array('response' => (object) array('result_code' => 0, 'bill' => (object) array('bill_id' => 123)))); return $this->mock; }); $order = new Order(); $order->create(array('user_id' => 1, 'item' => 'New Lamp2', 'sum' => 543.21, 'tel' => '+7123', 'comment' => 'without', 'status' => 'new', 'lifetime' => date('Y-m-d H:i:s', time() + 3600 * 24 * 3))); $resp = $this->call('POST', Config::get('ff-qiwi-shop::testConfig.testUrl') . '/action/createBill', array('order_id' => '1')); $this->assertContains('Счёт выставлен', $resp->original['message']); }