Skip to content

Commit

Permalink
test: add typehints for tests, fix 2 return types in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris8934 authored and karser committed Feb 25, 2022
1 parent a55d619 commit b6e787c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions Tests/Functional/AbstractSaferpayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Payum\Core\PayumBuilder;
use Payum\Core\Registry\StorageRegistryInterface;
use Payum\Core\Reply\HttpRedirect;
use Payum\Core\Reply\ReplyInterface;
use Payum\Core\Request\Capture;
use Payum\Core\Request\GetHumanStatus;
use Payum\Core\Security\TokenInterface;
Expand Down Expand Up @@ -136,7 +137,7 @@ protected function composeFormData(string $card, bool $cvc = true): array
return $data;
}

protected function capture(TokenInterface $token, PaymentInterface $payment): ?HttpRedirect
protected function capture(TokenInterface $token, PaymentInterface $payment): ?ReplyInterface
{
$captureRequest = new Capture($token);
$captureRequest->setModel($payment);
Expand Down Expand Up @@ -287,7 +288,7 @@ protected function createInsertedCardAlias(array $options): CardAliasInterface
return $cardAlias;
}

protected function insertCardAlias(TokenInterface $token, CardAliasInterface $cardAlias): ?HttpRedirect
protected function insertCardAlias(TokenInterface $token, CardAliasInterface $cardAlias): ?ReplyInterface
{
$insertCardAliasRequest = new InsertCardAlias($token);
$insertCardAliasRequest->setModel($cardAlias);
Expand Down
4 changes: 2 additions & 2 deletions Tests/Functional/CardAliasTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CardAliasTest extends AbstractSaferpayTest
/**
* @test
*/
public function insertAlias()
public function insertAlias(): void
{
$cardAlias = $this->createCardAlias([
'Alias' => [
Expand Down Expand Up @@ -63,7 +63,7 @@ public function insertAlias()
/**
* @test
*/
public function deleteAlias()
public function deleteAlias(): void
{
$cardAlias = $this->createInsertedCardAlias([]);
self::assertNotNull($cardAlias->getDetails()['Alias']['Id']);
Expand Down
4 changes: 2 additions & 2 deletions Tests/Functional/TransactionAdvancedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TransactionAdvancedTest extends AbstractSaferpayTest
/**
* @test
*/
public function refund()
public function refund(): void
{
$payment = $this->createCapturedPayment([]);
$this->assertStatus(GetHumanStatus::STATUS_CAPTURED, $payment);
Expand All @@ -23,7 +23,7 @@ public function refund()

}

public static function paymentRecurringProvider()
public static function paymentRecurringProvider(): array
{
return [
[
Expand Down
10 changes: 5 additions & 5 deletions Tests/Unit/Action/Api/InitTransactionActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class InitTransactionActionTest extends BaseApiActionTest
/**
* @test
*/
public function throwIfPaymentNotSetInModel()
public function throwIfPaymentNotSetInModel(): void
{
$this->expectExceptionMessage("Payment is missing");
$this->expectException(\Payum\Core\Exception\LogicException::class);
Expand All @@ -24,7 +24,7 @@ public function throwIfPaymentNotSetInModel()
/**
* @test
*/
public function throwIfReturnsUrlNotSetInModel()
public function throwIfReturnsUrlNotSetInModel(): void
{
$this->expectExceptionMessage("ReturnUrls is missing");
$this->expectException(\Payum\Core\Exception\LogicException::class);
Expand All @@ -35,7 +35,7 @@ public function throwIfReturnsUrlNotSetInModel()
/**
* @test
*/
public function shouldCallApiInitTransactionMethodWithExpectedRequiredArguments()
public function shouldCallApiInitTransactionMethodWithExpectedRequiredArguments(): void
{
$apiMock = $this->createApiMock();
$apiMock
Expand All @@ -58,7 +58,7 @@ public function shouldCallApiInitTransactionMethodWithExpectedRequiredArguments(
/**
* @test
*/
public function shouldNotCallApiInitTransactionMethod_ifTokenSetInModel()
public function shouldNotCallApiInitTransactionMethod_ifTokenSetInModel(): void
{
$apiMock = $this->createApiMock();
$apiMock
Expand All @@ -76,7 +76,7 @@ public function shouldNotCallApiInitTransactionMethod_ifTokenSetInModel()
/**
* @test
*/
public function shouldThrowRedirect_ifSet()
public function shouldThrowRedirect_ifSet(): void
{
$this->expectException(\Payum\Core\Reply\HttpRedirect::class);
$apiMock = $this->createApiMock();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Unit/Action/ConvertPaymentActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function provideNotSupportedRequests(): \Iterator
/**
* @test
*/
public function shouldCorrectlyConvertOrderToDetailsAndSetItBack()
public function shouldCorrectlyConvertOrderToDetailsAndSetItBack(): void
{
$payment = new Payment();
$payment->setNumber('theNumber');
Expand Down Expand Up @@ -95,7 +95,7 @@ public function shouldCorrectlyConvertOrderToDetailsAndSetItBack()
/**
* @test
*/
public function shouldNotOverwriteAlreadySetExtraDetails()
public function shouldNotOverwriteAlreadySetExtraDetails(): void
{
$payment = new Payment();
$payment->setNumber('theNumber');
Expand Down

0 comments on commit b6e787c

Please sign in to comment.