39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Bid\UseCases;
|
|
|
|
use FreightQuote\Bid\Bid;
|
|
use FreightQuote\Bid\UseCases\GetBidsOfFreightOrderRequest;
|
|
use FreightQuote\Bid\UseCases\GetBidsOfFreightOrder;
|
|
use PHPUnit\Framework\TestCase;
|
|
use Tests\Fakes\Bid\FakeBidRepository;
|
|
|
|
class GetBidsOfFreightOrderTest extends TestCase
|
|
{
|
|
private FakeBidRepository $bidRepo;
|
|
|
|
private GetBidsOfFreightOrder $useCase;
|
|
|
|
public function setUp(): void
|
|
{
|
|
$this->bidRepo = new FakeBidRepository();
|
|
$this->useCase = new GetBidsOfFreightOrder($this->bidRepo);
|
|
}
|
|
|
|
public function test_get_one_bid(): void
|
|
{
|
|
$this->bidRepo->save(new Bid(0, 0, 0, false, false, 0, '', []));
|
|
$dto = new GetBidsOfFreightOrderRequest(freightOrderId: 0);
|
|
$bids = $this->useCase->execute($dto);
|
|
$this->assertInstanceOf(Bid::class, $bids[0]);
|
|
}
|
|
|
|
public function test_get_two_bids(): void
|
|
{
|
|
$this->bidRepo->save(new Bid(0, 0, 0, false, false, 0, '', []));
|
|
$this->bidRepo->save(new Bid(1, 0, 0, false, false, 0, '', []));
|
|
$dto = new GetBidsOfFreightOrderRequest(freightOrderId: 0);
|
|
$bids = $this->useCase->execute($dto);
|
|
$this->assertInstanceOf(Bid::class, $bids[1]);
|
|
}
|
|
}
|