/** * Calls the runner's it() method, creating a test spec with the provided closure. * * @param string $title A title associated with this spec * @param \Closure $closure The closure associated with the spec */ function it($title, \Closure $closure = null) { pho\it($title, $closure); }
$params = ['out_trade_no' => '1217752501201407033233368018']; $res = $this->payment->closeOrder($params); \pho\expect($res['result_code'])->toBe(\wechat\Payment::SUCCESS); }); }); \pho\context('query refund', function () { \pho\it('should response error if refund not exist', function () { $params = ['out_trade_no' => $this->order['id']]; $res = $this->payment->queryRefund($params); \pho\expect($res['result_code'])->toBe(\wechat\Payment::FAIL); \pho\expect($res['err_code'])->toBe('REFUNDNOTEXIST'); }); }); \pho\context('download bill', function () { \pho\it('should response success', function () { $params = ['bill_date' => '20150804', 'bill_type' => 'ALL']; $self = $this; \pho\expect(function () use($self, $params) { $self->payment->downloadBill($params); })->toThrow('\\Exception'); }); }); \pho\context('refund', function () { \pho\it('should be fail if order is invalid', function () { $params = ['out_trade_no' => $this->order['id'], 'total_fee' => 888, 'out_refund_no' => '1217752501201407033233368018', 'refund_fee' => 888, 'op_user_id' => '1900000109']; $res = $this->payment->refund($params); \pho\expect($res['result_code'])->toEql(\wechat\Payment::FAIL); \pho\expect($res['err_code'])->toEql('ORDERNOTEXIST'); }); }); });