ldc-arcadia-genesis-php-client/tests/Unit/Lib/ApiValueObject/BrandCodeTest.php

44 lines
923 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Lib\ApiValueObject;
use Uwil\ArcadiaApiPhpClient\Lib\ApiValueObject\BrandCode;
describe('BrandCode test', function () {
it('can instanciate BrandCode', function () {
// GIVEN
$value = 'LGL23';
// WHEN
$brandCode = new BrandCode($value);
// THEN
expect($brandCode)->toBeInstanceOf(BrandCode::class);
});
});
describe('BrandCode validation', function () {
it('throws an exception for invalid code', function (string $dataValue) {
// GIVEN
$value = $dataValue;
// THEN
$this->expectException(\DomainException::class);
// WHEN
new BrandCode($value);
})->with([
['invalid'],
[''],
['23'],
['L23'],
['LG23'],
['LGL2'],
['LGL234'],
['LGL2A'],
['LGL2@'],
['LGL2 '],
]);
});