@@ -24,19 +24,24 @@ class SearchTest extends WebapiAbstract
2424 */
2525 private $ product ;
2626
27+ /**
28+ * @inheritDoc
29+ */
2730 protected function setUp (): void
2831 {
2932 $ productSku = 'simple ' ;
3033
3134 $ objectManager = Bootstrap::getObjectManager ();
32- $ productRepository = $ objectManager ->create (ProductRepositoryInterface::class);
35+ $ productRepository = $ objectManager ->get (ProductRepositoryInterface::class);
3336 $ this ->product = $ productRepository ->get ($ productSku );
3437 }
3538
3639 /**
37- * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
40+ * Tests that webapi call returns response when search criteria is valid.
41+ *
42+ * @magentoApiDataFixture Magento/Catalog/_files/products.php
3843 */
39- public function testExistingProductSearch ()
44+ public function testExistingProductSearch (): void
4045 {
4146 $ productName = $ this ->product ->getName ();
4247
@@ -47,14 +52,16 @@ public function testExistingProductSearch()
4752
4853 self ::assertArrayHasKey ('search_criteria ' , $ response );
4954 self ::assertArrayHasKey ('items ' , $ response );
50- self ::assertGreaterThan (0 , count ($ response ['items ' ]));
55+ self ::assertGreaterThan (1 , count ($ response ['items ' ]));
5156 self ::assertGreaterThan (0 , $ response ['items ' ][0 ]['id ' ]);
5257 }
5358
5459 /**
55- * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
60+ * Tests that response is empty if invalid data is provided.
61+ *
62+ * @magentoApiDataFixture Magento/Catalog/_files/products.php
5663 */
57- public function testNonExistentProductSearch ()
64+ public function testNonExistentProductSearch (): void
5865 {
5966 $ searchCriteria = $ this ->buildSearchCriteria ('nonExistentProduct ' );
6067 $ serviceInfo = $ this ->buildServiceInfo ($ searchCriteria );
0 commit comments