Skip to content

Commit

Permalink
fix: type and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois-Gomis committed Jan 20, 2025
1 parent ff3fb92 commit 8de3d9d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Endpoints/Merchants.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function sendCartInitiatedBusinessEvent(CartInitiatedBusinessEvent $cartE
}

/**
* Prepare and send a business event for a cart initiated
* Prepare and send a business event for Order confirmed
*
* @param OrderConfirmedBusinessEvent $orderConfirmedBusinessEvent
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OrderConfirmedBusinessEvent extends AbstractBusinessEvent
*/
private $cartId;
/**
* @var string
* @var string | null
*/
private $almaPaymentId;

Expand Down
15 changes: 5 additions & 10 deletions tests/Unit/Endpoints/MerchantsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Alma\API\Endpoints\Merchants;
use Alma\API\Entities\DTO\MerchantBusinessEvent\CartInitiatedBusinessEvent;
use Alma\API\Entities\DTO\MerchantBusinessEvent\OrderConfirmedBusinessEvent;
use Alma\API\Exceptions\ParametersException;
use Alma\API\Exceptions\RequestException;
use Alma\API\Request;
use Alma\API\RequestError;
Expand Down Expand Up @@ -45,6 +44,7 @@ public function setUp(): void
$this->clientContext->logger = $loggerMock;
$this->merchantEndpoint->setClientContext($this->clientContext);
}

public function tearDown(): void
{
$this->merchantEndpoint = null;
Expand All @@ -69,6 +69,7 @@ public function testSendBusinessEventPostThrowRequestErrorThrowRequestException(
$this->expectException(RequestException::class);
$this->merchantEndpoint->sendCartInitiatedBusinessEvent(new CartInitiatedBusinessEvent('42'));
}

public function testSendBusinessEventBadResponseRequestException()
{
$this->merchantEndpoint->shouldReceive('request')
Expand All @@ -88,10 +89,7 @@ public function testSendBusinessEventBadResponseRequestException()
$this->expectException(RequestException::class);
$this->merchantEndpoint->sendCartInitiatedBusinessEvent(new CartInitiatedBusinessEvent('42'));
}
/**
*
* @return void
*/

public function testSendCartInitiatedEvent()
{
$cartInitiatedEvent = new CartInitiatedBusinessEvent('42');
Expand All @@ -107,10 +105,7 @@ public function testSendCartInitiatedEvent()
$this->requestObject->shouldReceive('post')->once()->andReturn($this->responseMock);
$this->assertNull($this->merchantEndpoint->sendCartInitiatedBusinessEvent($cartInitiatedEvent));
}
/**
*
* @return void
*/

public function testSendOrderConfirmedBusinessEventForNonAlmaPayment()
{
$orderConfirmedBusinessEvent = new OrderConfirmedBusinessEvent(
Expand Down Expand Up @@ -142,6 +137,7 @@ public function testSendOrderConfirmedBusinessEventForNonAlmaPayment()
$this->requestObject->shouldReceive('post')->once()->andReturn($this->responseMock);
$this->assertNull($this->merchantEndpoint->sendOrderConfirmedBusinessEvent($orderConfirmedBusinessEvent));
}

public function testSendOrderConfirmedBusinessEventForAlmaPayment()
{
$orderConfirmedBusinessEvent = new OrderConfirmedBusinessEvent(
Expand Down Expand Up @@ -174,5 +170,4 @@ public function testSendOrderConfirmedBusinessEventForAlmaPayment()
$this->requestObject->shouldReceive('post')->once()->andReturn($this->responseMock);
$this->assertNull($this->merchantEndpoint->sendOrderConfirmedBusinessEvent($orderConfirmedBusinessEvent));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function testAlmaPaymentIdIsMandatoryForBnplAlmaPayment()
$this->expectException(ParametersException::class);
new OrderConfirmedBusinessEvent(false, true, true, "42", "54");
}

public function testAlmaPaymentIdShouldBeAbsentForNonAlmaPayments()
{
$this->expectException(ParametersException::class);
Expand Down Expand Up @@ -92,7 +93,6 @@ public function testAlmaPaymentIdDataForAlmaPayment()
}
}


public static function invalidDataForBusinessEventDataProvider()
{
return [
Expand Down

0 comments on commit 8de3d9d

Please sign in to comment.