Skip to content

Commit

Permalink
Merge pull request #287 from open-source-contributions/improve_assertion
Browse files Browse the repository at this point in the history
Improve null and boolean assertions
  • Loading branch information
bobbrodie authored Jan 26, 2024
2 parents c8e09bc + 02aa1cb commit 2a0bdc1
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 30 deletions.
8 changes: 4 additions & 4 deletions test/functional/BitPaySDK/PayoutRecipientsClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testGetPayoutRecipient()
self::assertEquals('[email protected]', $recipient->getEmail());
self::assertEquals('recipient1', $recipient->getLabel());
self::assertEquals('invited', $recipient->getStatus());
self::assertEquals(null, $recipient->getShopperId());
self::assertNull($recipient->getShopperId());
}

public function testPayoutRecipientShouldCatchRestCliException(): void
Expand Down Expand Up @@ -117,7 +117,7 @@ public function testDeletePayoutRecipient(): void

$result = $this->client->deletePayoutRecipient($payoutRecipientId);

self::assertEquals(true, $result);
self::assertTrue($result);
}

public function testPayoutRecipientRequestNotification(): void
Expand All @@ -135,6 +135,6 @@ public function testPayoutRecipientRequestNotification(): void

$result = $this->client->requestPayoutRecipientNotification($payoutRecipientId);

self::assertEquals(true, $result);
self::assertTrue($result);
}
}
}
4 changes: 2 additions & 2 deletions test/unit/BitPaySDK/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3095,7 +3095,7 @@ public function testCancelInvoice()

$result = $testedObject->cancelInvoice(self::TEST_INVOICE_ID, $params['forceCancel']);
self::assertEquals(self::TEST_INVOICE_ID, $result->getId());
self::assertEquals(true, $result->getIsCancelled());
self::assertTrue($result->getIsCancelled());
}

/**
Expand Down Expand Up @@ -3149,7 +3149,7 @@ public function testCancelInvoiceByGuid()
$result = $testedObject->cancelInvoiceByGuid(self::TEST_INVOICE_GUID, $params['forceCancel']);
self::assertEquals(self::TEST_INVOICE_GUID, $result->getGuid());
self::assertEquals(self::TEST_INVOICE_ID, $result->getId());
self::assertEquals(true, $result->getIsCancelled());
self::assertTrue($result->getIsCancelled());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/unit/BitPaySDK/Exceptions/BitPayExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testDefaultApiCode()
{
$exception = $this->createClassObject();

self::assertEquals(null, $exception->getApiCode());
self::assertNull($exception->getApiCode());
}

public function testDefaultCode()
Expand Down Expand Up @@ -57,4 +57,4 @@ private function createClassObject()
{
return new BitPayException();
}
}
}
2 changes: 1 addition & 1 deletion test/unit/BitPaySDK/Model/Bill/BillTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public function testToArray()
self::assertEquals([''], $billArray['cc']);
self::assertEquals('123456789', $billArray['phone']);
self::assertEquals('2022-01-01', $billArray['dueDate']);
self::assertEquals(true, $billArray['passProcessingFee']);
self::assertTrue($billArray['passProcessingFee']);
self::assertEquals('status', $billArray['status']);
self::assertEquals('http://test.com', $billArray['url']);
self::assertEquals('2022-01-01', $billArray['createDate']);
Expand Down
8 changes: 4 additions & 4 deletions test/unit/BitPaySDK/Model/CurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public function testToArray()
self::assertEquals('BTC', $currencyArray['code']);
self::assertEquals('Symbol', $currencyArray['symbol']);
self::assertEquals(1, $currencyArray['precision']);
self::assertEquals(true, $currencyArray['currentlySettled']);
self::assertTrue($currencyArray['currentlySettled']);
self::assertEquals('Bitcoin', $currencyArray['name']);
self::assertEquals('plural', $currencyArray['plural']);
self::assertEquals('alts', $currencyArray['alts']);
self::assertEquals('minimum', $currencyArray['minimum']);
self::assertEquals(true, $currencyArray['sanctioned']);
self::assertTrue($currencyArray['sanctioned']);
self::assertEquals('decimals', $currencyArray['decimals']);
self::assertEquals(['test'], $currencyArray['payoutFields']);
self::assertEquals(['test'], $currencyArray['settlementMinimum']);
Expand Down Expand Up @@ -89,7 +89,7 @@ public function testGetCurrentlySettled()
{
$currency = $this->createClassObject();
$currency->setCurrentlySettled(true);
self::assertEquals(true, $currency->getCurrentlySettled());
self::assertTrue($currency->getCurrentlySettled());
}

public function testGetName()
Expand Down Expand Up @@ -124,7 +124,7 @@ public function testGetSanctioned()
{
$currency = $this->createClassObject();
$currency->setSanctioned(true);
self::assertEquals(true, $currency->getSanctioned());
self::assertTrue($currency->getSanctioned());
}

public function testGetDecimals()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function testToArray()
self::assertEquals('[email protected]', $buyerProvidedInfoArray['emailAddress']);
self::assertEquals('BTC', $buyerProvidedInfoArray['selectedTransactionCurrency']);
self::assertEquals('4445556666', $buyerProvidedInfoArray['sms']);
self::assertEquals(true, $buyerProvidedInfoArray['smsVerified']);
self::assertTrue($buyerProvidedInfoArray['smsVerified']);
}

public function testToArrayEmptyKey()
Expand Down
2 changes: 1 addition & 1 deletion test/unit/BitPaySDK/Model/Invoice/ItemizedDetailsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testToArray()

self::assertEquals(15.5, $itemizedDetailsArray['amount']);
self::assertEquals('Test description', $itemizedDetailsArray['description']);
self::assertEquals(true, $itemizedDetailsArray['isFee']);
self::assertTrue($itemizedDetailsArray['isFee']);
}

private function createClassObject(): ItemizedDetails
Expand Down
6 changes: 3 additions & 3 deletions test/unit/BitPaySDK/Model/Invoice/RefundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ public function testToArray()
self::assertEquals('2022-01-01', $refundArray['requestDate']);
self::assertEquals('pending', $refundArray['status']);
self::assertEquals('11', $refundArray['invoiceId']);
self::assertEquals(true, $refundArray['preview']);
self::assertEquals(true, $refundArray['immediate']);
self::assertTrue($refundArray['preview']);
self::assertTrue($refundArray['immediate']);
self::assertEquals(1.0, $refundArray['refundFee']);
self::assertEquals('Invoice', $refundArray['invoice']);
self::assertEquals(true, $refundArray['buyerPaysRefundFee']);
self::assertTrue($refundArray['buyerPaysRefundFee']);
self::assertEquals('Reference', $refundArray['reference']);
self::assertEquals('Last refunded notification', $refundArray['lastRefundNotification']);
}
Expand Down
6 changes: 3 additions & 3 deletions test/unit/BitPaySDK/Model/Invoice/RefundWebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public function testToArray()
self::assertEquals('USD', $refundWebhookArray['currency']);
self::assertEquals('2022-01-11T16:58:23.967Z', $refundWebhookArray['lastRefundNotification']);
self::assertEquals(2.31, $refundWebhookArray['refundFee']);
self::assertEquals(false, $refundWebhookArray['immediate']);
self::assertEquals(true, $refundWebhookArray['buyerPaysRefundFee']);
self::assertFalse($refundWebhookArray['immediate']);
self::assertTrue($refundWebhookArray['buyerPaysRefundFee']);
self::assertEquals('2022-01-11T16:58:23.000Z', $refundWebhookArray['requestDate']);
}

Expand All @@ -162,4 +162,4 @@ private function objectSetters(RefundWebhook $refundWebhook): void
$refundWebhook->setBuyerPaysRefundFee(true);
$refundWebhook->setRequestDate('2022-01-11T16:58:23.000Z');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testToArray()
self::assertArrayHasKey('enabled', $supportedTransactionCurrencyArray);
self::assertArrayHasKey('reason', $supportedTransactionCurrencyArray);

self::assertEquals(true, $supportedTransactionCurrencyArray['enabled']);
self::assertTrue($supportedTransactionCurrencyArray['enabled']);
self::assertEquals("My reason", $supportedTransactionCurrencyArray['reason']);
}

Expand Down
12 changes: 6 additions & 6 deletions test/unit/BitPaySDK/Model/Wallet/CurrenciesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ public function testToArray()
self::assertArrayHasKey('walletConnect', $currenciesArray);

self::assertEquals('BTH', $currenciesArray['code']);
self::assertEquals(true, $currenciesArray['p2p']);
self::assertEquals(true, $currenciesArray['dappBrowser']);
self::assertTrue($currenciesArray['p2p']);
self::assertTrue($currenciesArray['dappBrowser']);
self::assertEquals('https://bitpay.com/api/images/logo-6fa5404d.svg', $currenciesArray['image']);
self::assertEquals(true, $currenciesArray['paypro']);
self::assertTrue($currenciesArray['paypro']);
self::assertEquals('BIP21', $currenciesArray['qr']['type']);
self::assertEquals(false, $currenciesArray['qr']['collapsed']);
self::assertFalse($currenciesArray['qr']['collapsed']);
self::assertEquals('1.23', $currenciesArray['withdrawalFee']);
self::assertEquals(true, $currenciesArray['walletConnect']);
self::assertTrue($currenciesArray['walletConnect']);
}

private function createClassObject(): Currencies
Expand All @@ -130,4 +130,4 @@ private function objectSetters(Currencies $currencies): void
$currencies->setWithdrawalFee('1.23');
$currencies->setWalletConnect(true);
}
}
}
4 changes: 2 additions & 2 deletions test/unit/BitPaySDK/Model/Wallet/CurrencyQrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testToArray()
self::assertArrayHasKey('collapsed', $currencyQrArray);

self::assertEquals('BIP21', $currencyQrArray['type']);
self::assertEquals(false, $currencyQrArray['collapsed']);
self::assertFalse($currencyQrArray['collapsed']);
}

private function createClassObject(): CurrencyQr
Expand All @@ -55,4 +55,4 @@ private function objectSetters(CurrencyQr $currencyQr): void
$currencyQr->setType('BIP21');
$currencyQr->setCollapsed(false);
}
}
}

0 comments on commit 2a0bdc1

Please sign in to comment.