コード例 #1
0
ファイル: ClientTest.php プロジェクト: davidanton1d/swish-php
 public function testCreateGetPaymentRequest()
 {
     $res = $this->client->createPaymentRequest($this->paymentRequest);
     codecept_debug($res->getStatusCode());
     codecept_debug($res->getHeaders());
     $this->assertEquals(201, $res->getStatusCode());
     $id = Util::getPaymentRequestIdFromResponse($res);
     $res = $this->client->getPaymentRequest($id);
     $body = Util::decodeResponse($res);
     codecept_debug($body);
     $this->assertEquals($id, $body['id']);
 }
コード例 #2
0
 /**
  * @dataProvider handlerProvider
  * @param $handler
  * @param bool $shouldTestWithHandler
  */
 public function testCreateGetPaymentRequestWithHandler($handler, $shouldTestWithHandler)
 {
     if (!$shouldTestWithHandler) {
         $this->markTestSkipped('Skipping handler test with ' . get_class($handler));
     }
     $client = $this->makeClient($handler);
     $paymentRequest = $this->paymentRequest;
     $paymentRequest['payerAlias'] = $this->randomSwedishPhoneNumber();
     codecept_debug($paymentRequest['payerAlias']);
     $res = $client->createPaymentRequest($paymentRequest);
     codecept_debug($res->getStatusCode());
     codecept_debug($res->getHeaders());
     codecept_debug((string) $res->getBody());
     $this->assertEquals(201, $res->getStatusCode());
     $id = Util::getPaymentRequestIdFromResponse($res);
     $res = $client->getPaymentRequest($id);
     $body = Util::decodeResponse($res);
     codecept_debug($body);
     $this->assertEquals($id, $body['id']);
 }
コード例 #3
0
 public function testDecodeResponse()
 {
     $response = new Response(200, [], '{ "hello":"world" }');
     $decoded = Util::decodeResponse($response);
     $this->assertEquals(['hello' => 'world'], $decoded);
 }