CodeExplorer LineItemValidator example
#[Package('checkout')]
class LineItemValidatorTest extends TestCase
{ public function testValidateEmptyCart(): void
{ $cart =
new Cart('test'
);
$validator =
new LineItemValidator();
$errors =
new ErrorCollection();
$validator->
validate($cart,
$errors,
$this->
createMock(SalesChannelContext::
class));
static::
assertCount(0,
$errors);
} public function testValidateWithValidLineItem(): void
{ $cart =
new Cart('test'
);
$lineItem =
new LineItem('id', 'fake'
);
$lineItem->
setLabel('Label'
);