$this->productRepository->
create([$data],
$context);
$criteria =
new Criteria([$data['id'
]]);
$criteria->
addAssociation('cover'
);
$results =
$this->productRepository->
search($criteria,
$context);
/** @var ProductEntity $product */
$product =
$results->
first();
static::
assertNotNull($product, 'Product has not been created.'
);
static::
assertNotNull($product->
getCover(), 'Cover was not fetched.'
);
static::
assertNotNull($product->
getCover()->
getMedia(), 'Media for cover was not fetched.'
);
$mediaThumbnailCollection =
$product->
getCover()->
getMedia()->
getThumbnails();
static::
assertNotNull($mediaThumbnailCollection);
static::
assertCount(3,
$mediaThumbnailCollection->
getElements(), 'Thumbnails were not fetched or is incomplete.'
);
} public function testAddTranslationsAssociation(): void
{ $repo =
$this->
getContainer()->
get('category.repository'
);
$id = Uuid::
randomHex();
$cats =
[ [