36 lines
847 B
PHP
36 lines
847 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Lib\ApiValueObject;
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Lib\ApiValueObject\EstablishmentCode;
|
|
|
|
describe('EstablishmentCode test', function () {
|
|
it('can instanciate EstablishmentCode', function () {
|
|
// GIVEN
|
|
$value = '123';
|
|
|
|
// WHEN
|
|
$establishmentCode = new EstablishmentCode($value);
|
|
|
|
// THEN
|
|
expect($establishmentCode)->toBeInstanceOf(EstablishmentCode::class);
|
|
});
|
|
});
|
|
|
|
describe('EstablishmentCode validation', function () {
|
|
it('throws an exception for invalid code', function (string $dataValue) {
|
|
// GIVEN
|
|
$value = $dataValue;
|
|
|
|
// THEN
|
|
$this->expectException(\DomainException::class);
|
|
|
|
// WHEN
|
|
new EstablishmentCode($value);
|
|
})->with([
|
|
[''],
|
|
['invalid'],
|
|
]);
|
|
});
|