ldc-legaulois/tests/Unit/Lib/Axepta/AxeptaOrderTest.php
2026-06-23 16:12:23 +02:00

87 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Lib\Axepta;
use App\Lib\Axepta\Objects\AxeptaOrder;
use DomainException;
use Tests\TestCase;
class AxeptaOrderTest extends TestCase
{
public function testCanInstanciateAnAxeptaOrder(): void
{
// GIVEN
$reference = 'IRDtm95jvhCN';
$amount = 200;
$email = 'valid-email@example.org';
// WHEN
$order = new AxeptaOrder(
$reference,
$amount,
$email,
);
// THEN
$this->assertInstanceOf(AxeptaOrder::class, $order);
}
public function testCannotInstanciateAnAxeptaOrderWithEmptyReference(): void
{
$this->assertThrows(function () {
// GIVEN
$reference = '';
$amount = 200;
$email = 'valid-email@example.org';
// WHEN
new AxeptaOrder(
$reference,
$amount,
$email,
);
// THEN
}, DomainException::class);
}
public function testCannotInstanciateAnAxeptaOrderWithNonPositiveAmount(): void
{
$this->assertThrows(function () {
// GIVEN
$reference = 'IRDtm95jvhCN';
$amount = 0;
$email = 'valid-email@example.org';
// WHEN
new AxeptaOrder(
$reference,
$amount,
$email,
);
// THEN
}, DomainException::class);
}
public function testCannotInstanciateAnAxeptaOrderWithInvalidEmail(): void
{
$this->assertThrows(function () {
// GIVEN
$reference = 'IRDtm95jvhCN';
$amount = 200;
$email = 'invalid-email';
// WHEN
new AxeptaOrder(
$reference,
$amount,
$email,
);
// THEN
}, DomainException::class);
}
}