/** * @test */ public function shouldReturnInstanceOfCardOnUpdate() { $cardData = array('id' => 'ade869d8-7913-4f67-bb4d-72719f0a2be0'); $data = array('foo' => 'bar'); $response = $this->getResponseMock(array_merge($cardData, $data)); $client = $this->getUpholdClientMock(); $client->expects($this->once())->method('patch')->with(sprintf('/me/cards/%s', $cardData['id']), $data)->will($this->returnValue($response)); $card = new Card($client, $cardData); $this->assertInstanceOf('Uphold\\Model\\Card', $card->update($data)); }
/** * @test */ public function shouldCreateNewTransaction() { $cardData = array('id' => 'ade869d8-7913-4f67-bb4d-72719f0a2be0'); $postData = array('destination' => $this->getFaker()->email, 'denomination' => array('amount' => $this->getFaker()->randomFloat, 'currency' => $this->getFaker()->currencyCode)); $data = array('id' => 'a97bb994-6e24-4a89-b653-e0a6d0bcf634', 'status' => 'pending'); $response = $this->getResponseMock($data); $client = $this->getUpholdClientMock(); $client->expects($this->once())->method('post')->with(sprintf('/me/cards/%s/transactions', $cardData['id']), $postData)->will($this->returnValue($response)); $card = new Card($client, $cardData); $transaction = $card->createTransaction($postData['destination'], $postData['denomination']['amount'], $postData['denomination']['currency']); $this->assertInstanceOf('Uphold\\Model\\Transaction', $transaction); $this->assertEquals($data['id'], $transaction->getId()); }