From 615019e9e3037521470537e702931d96afbbc469 Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 22 Nov 2020 06:31:26 +1300 Subject: [PATCH] [NFC] Minor margin tidy up Just fixes all the things that get marked as 'not best practice' in the IDE --- .../tests/phpunit/CancelTest.php | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/ext/contributioncancelactions/tests/phpunit/CancelTest.php b/ext/contributioncancelactions/tests/phpunit/CancelTest.php index 3e850a5428..946b3484d4 100644 --- a/ext/contributioncancelactions/tests/phpunit/CancelTest.php +++ b/ext/contributioncancelactions/tests/phpunit/CancelTest.php @@ -1,5 +1,7 @@ createContact(); $this->createMembershipType(); Relationship::create()->setValues([ @@ -97,11 +101,9 @@ class CancelTest extends \PHPUnit\Framework\TestCase implements HeadlessInterfac /** * Create an order with more than one membership. * - * @throws \API_Exception * @throws \CRM_Core_Exception - * @throws \Civi\API\Exception\UnauthorizedException */ - protected function createMembershipOrder() { + protected function createMembershipOrder(): void { $priceFieldID = $this->callAPISuccessGetValue('price_field', [ 'return' => 'id', 'label' => 'Membership Amount', @@ -178,7 +180,7 @@ class CancelTest extends \PHPUnit\Framework\TestCase implements HeadlessInterfac * @return int * @throws \CRM_Core_Exception */ - public function createPaymentProcessor($params = []) { + public function createPaymentProcessor($params = []): int { $params = array_merge([ 'name' => 'demo', 'domain_id' => CRM_Core_Config::domainID(), @@ -215,9 +217,9 @@ class CancelTest extends \PHPUnit\Framework\TestCase implements HeadlessInterfac * Test that a cancel from paypal pro results in an order being cancelled. * * @throws \API_Exception - * @throws \CRM_Core_Exception + * @throws \CRM_Core_Exception|\CiviCRM_API3_Exception */ - public function testPaypalStandardCancel() { + public function testPaypalStandardCancel(): void { $this->createContact(); $orderID = $this->createEventOrder(); $ipn = new CRM_Core_Payment_PayPalIPN([ @@ -241,7 +243,7 @@ class CancelTest extends \PHPUnit\Framework\TestCase implements HeadlessInterfac * @throws API_Exception * @throws CRM_Core_Exception */ - public function testCancelOrderWithParticipant() { + public function testCancelOrderWithParticipant(): void { $this->createContact(); $orderID = $this->createEventOrder(); $this->callAPISuccess('Order', 'cancel', ['contribution_id' => $orderID]); @@ -259,7 +261,7 @@ class CancelTest extends \PHPUnit\Framework\TestCase implements HeadlessInterfac * @throws CRM_Core_Exception * @throws API_Exception */ - public function testCancelOrderWithPledge() { + public function testCancelOrderWithPledge(): void { $this->createContact(); $pledgeID = (int) $this->callAPISuccess('Pledge', 'create', ['contact_id' => $this->ids['contact'][0], 'amount' => 4, 'installments' => 2, 'frequency_unit' => 'month', 'original_installment_amount' => 2, 'create_date' => 'now', 'financial_type_id' => 'Donation', 'start_date' => '+5 days'])['id']; $orderID = (int) $this->callAPISuccess('Order', 'create', ['contact_id' => $this->ids['contact'][0], 'total_amount' => 2, 'financial_type_id' => 'Donation', 'api.Payment.create' => ['total_amount' => 2]])['id']; @@ -281,7 +283,7 @@ class CancelTest extends \PHPUnit\Framework\TestCase implements HeadlessInterfac * @throws API_Exception * @throws CRM_Core_Exception */ - protected function createEventOrder() { + protected function createEventOrder(): int { $this->ids['event'][0] = (int) Event::create()->setValues(['title' => 'Event', 'start_date' => 'tomorrow', 'event_type_id:name' => 'Workshop'])->execute()->first()['id']; $order = $this->callAPISuccess('Order', 'create', [ 'contact_id' => $this->ids['contact'][0], -- 2.25.1