| 1 |
<?php |
| 2 |
|
| 3 |
declare( strict_types=1 ); |
| 4 |
|
| 5 |
namespace Tests\Core\Entity; |
| 6 |
|
| 7 |
use Packetery\Core\CoreHelper; |
| 8 |
use PHPUnit\Framework\TestCase; |
| 9 |
use Tests\Core\DummyFactory; |
| 10 |
|
| 11 |
class CustomsDeclarationTest extends TestCase { |
| 12 |
|
| 13 |
private const DUMMY_FILE_CONTENT = 'Dummy file content'; |
| 14 |
|
| 15 |
public function testSettersAndGetters(): void { |
| 16 |
$customsDeclaration = DummyFactory::createCustomsDeclaration(); |
| 17 |
|
| 18 |
$dummyId = 'dummyId'; |
| 19 |
$customsDeclaration->setId( $dummyId ); |
| 20 |
self::assertSame( $dummyId, $customsDeclaration->getId() ); |
| 21 |
|
| 22 |
$dummyDeliveryCost = 124.5; |
| 23 |
$customsDeclaration->setDeliveryCost( $dummyDeliveryCost ); |
| 24 |
self::assertSame( $dummyDeliveryCost, $customsDeclaration->getDeliveryCost() ); |
| 25 |
|
| 26 |
self::assertNull( $customsDeclaration->getEadFile() ); |
| 27 |
$dummyEad = 'dummyEad'; |
| 28 |
$customsDeclaration->setEad( $dummyEad ); |
| 29 |
self::assertSame( $dummyEad, $customsDeclaration->getEad() ); |
| 30 |
|
| 31 |
$customsDeclaration->setEadFile( |
| 32 |
function () { |
| 33 |
return self::DUMMY_FILE_CONTENT; |
| 34 |
}, |
| 35 |
true |
| 36 |
); |
| 37 |
self::assertSame( self::DUMMY_FILE_CONTENT, $customsDeclaration->getEadFile() ); |
| 38 |
self::assertTrue( $customsDeclaration->hasEadFileContent() ); |
| 39 |
|
| 40 |
$dummyEadFileId = 'dummyEadFileId'; |
| 41 |
$customsDeclaration->setEadFileId( $dummyEadFileId ); |
| 42 |
self::assertSame( $dummyEadFileId, $customsDeclaration->getEadFileId() ); |
| 43 |
|
| 44 |
self::assertNull( $customsDeclaration->getInvoiceFile() ); |
| 45 |
$customsDeclaration->setInvoiceFile( |
| 46 |
function () { |
| 47 |
return self::DUMMY_FILE_CONTENT; |
| 48 |
}, |
| 49 |
true |
| 50 |
); |
| 51 |
self::assertSame( self::DUMMY_FILE_CONTENT, $customsDeclaration->getInvoiceFile() ); |
| 52 |
self::assertTrue( $customsDeclaration->hasInvoiceFileContent() ); |
| 53 |
|
| 54 |
$dummyInvoiceFileId = 'dummyInvoiceFileId'; |
| 55 |
$customsDeclaration->setInvoiceFileId( $dummyInvoiceFileId ); |
| 56 |
self::assertSame( $dummyInvoiceFileId, $customsDeclaration->getInvoiceFileId() ); |
| 57 |
|
| 58 |
$dummyInvoiceIssueDate = CoreHelper::now(); |
| 59 |
$customsDeclaration->setInvoiceIssueDate( $dummyInvoiceIssueDate ); |
| 60 |
self::assertSame( $dummyInvoiceIssueDate, $customsDeclaration->getInvoiceIssueDate() ); |
| 61 |
|
| 62 |
$dummyInvoiceNumber = 'dummyInvoiceNumber'; |
| 63 |
$customsDeclaration->setInvoiceNumber( $dummyInvoiceNumber ); |
| 64 |
self::assertSame( $dummyInvoiceNumber, $customsDeclaration->getInvoiceNumber() ); |
| 65 |
|
| 66 |
$dummyMrn = 'dummyMrn'; |
| 67 |
$customsDeclaration->setMrn( $dummyMrn ); |
| 68 |
self::assertSame( $dummyMrn, $customsDeclaration->getMrn() ); |
| 69 |
|
| 70 |
self::assertIsString( $customsDeclaration->getOrderId() ); |
| 71 |
} |
| 72 |
} |
| 73 |
|