different_reviews.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php';
  7. $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
  8. \Magento\Review\Model\Review::class,
  9. ['data' => ['nickname' => 'Nickname', 'title' => 'Review Summary', 'detail' => 'Review text']]
  10. );
  11. $review->setEntityId(
  12. $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE)
  13. )->setEntityPkValue(
  14. 1
  15. )->setStatusId(
  16. \Magento\Review\Model\Review::STATUS_PENDING
  17. )->setStoreId(
  18. \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
  19. \Magento\Store\Model\StoreManagerInterface::class
  20. )->getStore()->getId()
  21. )->setStores(
  22. [
  23. \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
  24. \Magento\Store\Model\StoreManagerInterface::class
  25. )->getStore()->getId()
  26. ]
  27. )->save();
  28. $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
  29. \Magento\Review\Model\Review::class,
  30. ['data' => ['nickname' => 'Nickname', 'title' => '2 filter first review', 'detail' => 'Review text']]
  31. );
  32. $review->setEntityId(
  33. $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE)
  34. )->setEntityPkValue(
  35. 1
  36. )->setStatusId(
  37. \Magento\Review\Model\Review::STATUS_APPROVED
  38. )->setStoreId(
  39. \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
  40. \Magento\Store\Model\StoreManagerInterface::class
  41. )->getStore()->getId()
  42. )->setStores(
  43. [
  44. \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
  45. \Magento\Store\Model\StoreManagerInterface::class
  46. )->getStore()->getId()
  47. ]
  48. )->save();
  49. $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
  50. \Magento\Review\Model\Review::class,
  51. ['data' => ['nickname' => 'Nickname', 'title' => '1 filter second review', 'detail' => 'Review text']]
  52. );
  53. $review->setEntityId(
  54. $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE)
  55. )->setEntityPkValue(
  56. 1
  57. )->setStatusId(
  58. \Magento\Review\Model\Review::STATUS_APPROVED
  59. )->setStoreId(
  60. \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
  61. \Magento\Store\Model\StoreManagerInterface::class
  62. )->getStore()->getId()
  63. )->setStores(
  64. [
  65. \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
  66. \Magento\Store\Model\StoreManagerInterface::class
  67. )->getStore()->getId()
  68. ]
  69. )->save();