static::
assertInstanceOf(EntityWrittenEvent::
class,
$event);
static::
assertCount(2,
$event->
getWriteResults());
$criteria =
new Criteria([$id]);
$criteria->
addAssociation('visibilities'
);
/** @var ProductEntity $product */
$product =
$this->productRepository->
search($criteria,
$context)->
first();
// check visibilities can be loaded as association
static::
assertInstanceOf(ProductEntity::
class,
$product);
static::
assertInstanceOf(ProductVisibilityCollection::
class,
$product->
getVisibilities());
static::
assertCount(2,
$product->
getVisibilities());
// check read for visibilities
$criteria =
new Criteria();
$criteria->
addFilter(new EqualsFilter('product_visibility.productId',
$id));
$visibilities =
$this->visibilityRepository->
search($criteria,
$context);
static::
assertCount(2,
$visibilities);
// test filter visibilities over product
$criteria =
new Criteria([$id]);