44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Catalog;
|
|
|
|
use App\Domains\Catalog\Services\CatalogItemAllowanceService;
|
|
use ReflectionClass;
|
|
use Tests\TestCase;
|
|
|
|
class CatalogItemAllowanceServiceTest extends TestCase
|
|
{
|
|
private CatalogItemAllowanceService $service;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->service = (new ReflectionClass(CatalogItemAllowanceService::class))
|
|
->newInstanceWithoutConstructor();
|
|
}
|
|
|
|
public function test_it_returns_the_user_quota_message_with_priority_over_stock(): void
|
|
{
|
|
$this->assertSame(
|
|
'Alcanzaste el cupo máximo permitido para este producto.',
|
|
$this->service->unavailableMessage(0, 0),
|
|
);
|
|
}
|
|
|
|
public function test_it_returns_the_out_of_stock_message(): void
|
|
{
|
|
$this->assertSame(
|
|
'Este producto no tiene stock disponible.',
|
|
$this->service->unavailableMessage(0, null),
|
|
);
|
|
}
|
|
|
|
public function test_it_returns_no_message_when_the_item_is_available(): void
|
|
{
|
|
$this->assertNull($this->service->unavailableMessage(1, null));
|
|
$this->assertNull($this->service->unavailableMessage(null, 1));
|
|
$this->assertNull($this->service->unavailableMessage(null, null));
|
|
}
|
|
}
|