@@ -38,7 +38,8 @@ public function testExecuteNonExistingSearchKey() : void
38
38
->setPostValue ('limit ' , 50 );
39
39
$ this ->dispatch ('backend/catalog/product/search ' );
40
40
$ responseBody = $ this ->getResponse ()->getBody ();
41
- $ this ->assertContains ('{"options":[],"total":0} ' , $ responseBody );
41
+ $ jsonResponse = json_decode ($ responseBody , true );
42
+ $ this ->assertEmpty ($ jsonResponse ['options ' ]);
42
43
}
43
44
44
45
/**
@@ -57,6 +58,24 @@ public function testExecuteNotVisibleIndividuallyProducts() : void
57
58
->setPostValue ('limit ' , 50 );
58
59
$ this ->dispatch ('backend/catalog/product/search ' );
59
60
$ responseBody = $ this ->getResponse ()->getBody ();
60
- $ this ->assertContains ('{"options":[],"total":0} ' , $ responseBody );
61
+ $ jsonResponse = json_decode ($ responseBody , true );
62
+ $ this ->assertEquals (1 , $ jsonResponse ['total ' ]);
63
+ $ this ->assertCount (1 , $ jsonResponse ['options ' ]);
64
+ }
65
+
66
+ /**
67
+ * @magentoDataFixture Magento/Catalog/_files/multiple_mixed_products.php
68
+ */
69
+ public function testExecuteEnabledAndDisabledProducts () : void
70
+ {
71
+ $ this ->getRequest ()
72
+ ->setPostValue ('searchKey ' , 'simple ' )
73
+ ->setPostValue ('page ' , 1 )
74
+ ->setPostValue ('limit ' , 50 );
75
+ $ this ->dispatch ('backend/catalog/product/search ' );
76
+ $ responseBody = $ this ->getResponse ()->getBody ();
77
+ $ jsonResponse = json_decode ($ responseBody , true );
78
+ $ this ->assertEquals (6 , $ jsonResponse ['total ' ]);
79
+ $ this ->assertCount (6 , $ jsonResponse ['options ' ]);
61
80
}
62
81
}
0 commit comments