Skip to content

Commit

Permalink
Added assertions to tests missing it. (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Apr 5, 2018
1 parent 960a884 commit 36529a3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
20 changes: 14 additions & 6 deletions tests/Model/Generated/Endpoint/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,33 @@ public function testSendMoneyToOtherUser()
{
$this->skipTestIfNeededDueToInsufficientBalance();

Payment::create(
$response = Payment::create(
new Amount(self::PAYMENT_AMOUNT_IN_EUR, self::PAYMENT_CURRENCY),
$this->getPointerUserBravo(),
self::PAYMENT_DESCRIPTION
);

static::assertNotNull($response);
}

/**
* Test sending money to other monetaryAccount.
*
* This test has no assertion as of its testing to see if the code runs without errors.
*/
public function testSendMoneyToOtherMonetaryAccount()
public function testSendMoneyToOtherMonetaryAccount(): BunqResponseInt
{
$this->skipTestIfNeededDueToInsufficientBalance();

$paymentId = Payment::create(
new Amount(self::PAYMENT_AMOUNT_IN_EUR, self::PAYMENT_CURRENCY),
$this->getSecondMonetaryAccountAlias(),
self::PAYMENT_DESCRIPTION
)->getValue();
);

static::assertNotNull($paymentId);

return $paymentId;
}

/**
Expand All @@ -78,12 +84,14 @@ public function testSendMoneyToOtherMonetaryAccount()
*
* @depends testSendMoneyToOtherMonetaryAccount
*/
public function testSendMessageToPayment()
public function testSendMessageToPayment(BunqResponseInt $paymentId)
{
$chatId = PaymentChat::create(
$this->paymentId
$paymentId->getValue()
)->getValue();

ChatMessageText::create($chatId, self::PAYMENT_CHAT_TEXT_MESSAGE);
$response = ChatMessageText::create($chatId, self::PAYMENT_CHAT_TEXT_MESSAGE);

static::assertNotNull($response);
}
}
11 changes: 9 additions & 2 deletions tests/Model/Generated/Endpoint/RequestInquiryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public function testSendingAndAcceptingRequest()

$this->sendRequest();
$responses = RequestResponse::listing($this->getSecondMonetaryAccountId())->getValue();

static::assertNotNull($responses);

$requestResponseId = $responses[self::INDEX_FIRST]->getId();
$this->acceptRequest($requestResponseId);
}
Expand All @@ -53,24 +56,28 @@ public function testSendingAndAcceptingRequest()
*/
private function sendRequest()
{
RequestInquiry::create(
$response = RequestInquiry::create(
new Amount(self::REQUEST_AMOUNT_IN_EUR, self::REQUEST_CURRENCY),
$this->getSecondMonetaryAccountAlias(),
self::REQUEST_DESCRIPTION,
false
);

static::assertNotNull($response);
}

/**
* @param int $requestResponseId
*/
private function acceptRequest(int $requestResponseId)
{
RequestResponse::update(
$response = RequestResponse::update(
$requestResponseId,
$this->getSecondMonetaryAccountId(),
null,
self::REQUEST_STATUS_ACCEPTED
);

static::assertNotNull($response);
}
}

0 comments on commit 36529a3

Please sign in to comment.