use IntegrationTestBehaviour;
public function testLoadWithNotExistingToken(): void
{ $connection =
$this->
createMock(Connection::
class);
$cartSerializationCleaner =
$this->
createMock(CartSerializationCleaner::
class);
$eventDispatcher =
new EventDispatcher();
$connection->
expects(static::
once()) ->
method('fetchAssociative'
) ->
willReturn(false
);
$persister =
new CartPersister($connection,
$eventDispatcher,
$cartSerializationCleaner, false
);
$e = null;
try { $persister->
load('not_existing_token', Generator::
createSalesChannelContext());
} catch (\Exception
$e) { } static::
assertInstanceOf(CartTokenNotFoundException::
class,
$e);
static::
assertSame('not_existing_token',
$e->
getParameter('token'
));
}