File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed
dev/tests/integration/testsuite/Magento/Review Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,19 @@ public function testAddEntitySummaryToItem()
27
27
$ ratingData = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()
28
28
->get ('Magento\Framework\Registry ' )
29
29
->registry ('rating_data ' );
30
- $ this ->collection ->addEntitySummaryToItem ($ ratingData ->getEntityId (), $ ratingData ->getStoreId ());
30
+
31
+ $ result = $ this ->collection ->addEntitySummaryToItem ($ ratingData ->getEntityId (), $ ratingData ->getStoreId ());
32
+ $ this ->assertEquals ($ this ->collection , $ result );
33
+ }
34
+
35
+ public function testAddEntitySummaryToItemEmpty ()
36
+ {
37
+ foreach ($ this ->collection ->getItems () as $ item ) {
38
+ $ item ->delete ();
39
+ }
40
+ $ this ->collection ->clear ();
41
+ $ result = $ this ->collection ->addEntitySummaryToItem (1 , 1 );
42
+ $ this ->assertEquals ($ this ->collection , $ result );
31
43
}
32
44
33
45
public function testAddStoreData ()
Original file line number Diff line number Diff line change 5
5
*/
6
6
require __DIR__ . '/customer_review.php ' ;
7
7
8
+ $ storeId = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()
9
+ ->get ('Magento\Store\Model\StoreManagerInterface ' )
10
+ ->getStore ()
11
+ ->getId ();
12
+ /** @var \Magento\Review\Model\Rating $ratingModel */
8
13
$ ratingModel = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
9
14
'Magento\Review\Model\Rating ' ,
10
15
['data ' => [
11
16
'rating_code ' => 'test ' ,
12
- 'rating_codes ' => ['test ' ],
13
17
'position ' => 0 ,
14
- 'isActive ' => 1 ,
15
- 'entityId ' => $ review ->getEntityId ()
18
+ 'isActive ' => 1
16
19
]]
17
20
);
21
+ $ ratingModel ->setStoreId ($ storeId )
22
+ ->setStores ([$ storeId ])
23
+ ->setEntityId ($ ratingModel ->getEntityIdByCode (Magento \Review \Model \Rating::ENTITY_PRODUCT_CODE ))
24
+ ->setRatingCodes (['test ' ]);
18
25
$ ratingModel ->save ();
26
+
27
+ /** @var \Magento\Review\Model\Rating\Option $optionModel */
28
+ $ optionModel = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
29
+ 'Magento\Review\Model\Rating\Option '
30
+ );
31
+ $ optionModel ->setCode (1 )
32
+ ->setValue (1 )
33
+ ->setRatingId ($ ratingModel ->getId ())
34
+ ->setPosition (1 )
35
+ ->setReviewId ($ review ->getId ())
36
+ ->setEntityPkValue ($ product ->getId ())
37
+ ->save ();
38
+ $ optionModel ->addVote ();
39
+
19
40
\Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->get ('Magento\Framework\Registry ' )->register (
20
41
'rating_data ' ,
21
42
$ ratingModel
You can’t perform that action at this time.
0 commit comments