test update bid use case
This commit is contained in:
parent
e4c535201b
commit
9e2e6d9449
4 changed files with 89 additions and 0 deletions
36
tests/Unit/Bid/UseCases/UpdateBidTest.php
Normal file
36
tests/Unit/Bid/UseCases/UpdateBidTest.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit\Bid\UseCases;
|
||||
|
||||
use FreightQuote\Bid\Bid;
|
||||
use FreightQuote\Bid\UseCases\UpdateBid;
|
||||
use FreightQuote\Bid\UseCases\UpdateBidRequest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tests\Fakes\Bid\FakeBidRepository;
|
||||
|
||||
class UpdateBidTest extends TestCase
|
||||
{
|
||||
public function test_update(): void
|
||||
{
|
||||
$bidRepo = new FakeBidRepository();
|
||||
$bidRepo->save(new Bid(
|
||||
0, 0, 0, false, false, null, null, null
|
||||
));
|
||||
$useCase = new UpdateBid($bidRepo);
|
||||
$dto = new UpdateBidRequest(
|
||||
bidId: 0,
|
||||
data: [
|
||||
'isClosed' => true,
|
||||
'cost' => 1,
|
||||
'notes' => 'some notes',
|
||||
'fileAttachments' => ['/path/to/file']
|
||||
],
|
||||
);
|
||||
$useCase->execute($dto);
|
||||
$bid = $bidRepo->find(0);
|
||||
$this->assertEquals(true, $bid->isClosed());
|
||||
$this->assertEquals(1, $bid->getCost());
|
||||
$this->assertEquals('some notes', $bid->getNotes());
|
||||
$this->assertEquals(['/path/to/file'], $bid->getFileAttachments());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue