Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
review_xss.php
Go to the documentation of this file.
1 <?php
7 require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_xss.php';
8 
10 $productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
11 $product = $productRepository->get('product-with-xss');
12 
13 $review = $objectManager->create(\Magento\Review\Model\Review::class);
14 $review->setEntityId(
15  $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE)
16 )->setEntityPkValue(
17  $product->getId()
18 )->setStatusId(
19  \Magento\Review\Model\Review::STATUS_PENDING
20 )->setStoreId(
21  \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
22  \Magento\Store\Model\StoreManagerInterface::class
23  )->getStore()->getId()
24 )->setStores(
25  [
26  \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
27  \Magento\Store\Model\StoreManagerInterface::class
28  )->getStore()->getId()
29  ]
30 )->setNickname(
31  'Nickname'
32 )->setTitle(
33  'Review Summary'
34 )->setDetail(
35  'Review text'
36 )->save();
$review
Definition: review_xss.php:13
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$product
Definition: review_xss.php:11
$productRepository
Definition: review_xss.php:10
$objectManager
Definition: review_xss.php:9