$this->
createReview($reviewBId,
$pointsOnBReview,
$productId, true
);
$sql = <<<'SQL'
UPDATE product SET product.rating_average = 0;
SQL;
$this->connection->
executeStatement($sql);
$products =
$this->productRepository->
search(new Criteria([$productId]),
$this->salesChannel->
getContext());
static::
assertInstanceOf(ProductEntity::
class,
$product =
$products->
get($productId));
static::
assertEquals(0,
$product->
getRatingAverage());
$this->productIndexer->
handle(new EntityIndexingMessage([$productId]));
$products =
$this->productRepository->
search(new Criteria([$productId]),
$this->salesChannel->
getContext());
static::
assertInstanceOf(ProductEntity::
class,
$product =
$products->
get($productId));
static::
assertEquals(3,
$product->
getRatingAverage());
} /**
* update data in review repository
*
* @param array<int, array<string, mixed>> $data
*/