// fake database query
$repository =
$this->
getRepositoryMock($result);
$validator =
new AddressValidator($repository);
// fake country entity in context
$country =
$this->
getCountryStub($id,
$active,
$shippingAvailable);
$location =
new ShippingLocation($country, null, null
);
$context =
$this->
getContextMock($location);
$cart =
new Cart('test'
);
$errors =
new ErrorCollection();
$validator->
validate($cart,
$errors,
$context);
$shouldBeValid =
$assigned &&
$shippingAvailable &&
$active;
if ($shouldBeValid) { static::
assertCount(0,
$errors);
return;
}