@@ -19,20 +19,22 @@ protected function setUp()
19
19
}
20
20
21
21
/**
22
+ * Ensure that SalesRules filtering on category ignore product visibility
23
+ *
22
24
* @magentoAppIsolation enabled
23
25
* @param int $categoryId
24
26
* @param int $visibility
25
27
* @param bool $expectedResult
26
28
* @magentoDataFixture Magento/Checkout/_files/quote_with_simple_product.php
27
29
* @magentoDataFixture Magento/SalesRule/_files/rules_category.php
28
- * @magentoDataFixture Magento/SalesRule/_files/category.php
29
30
* @dataProvider validateProductConditionDataProvider
30
31
*/
31
32
public function testValidateCategorySalesRuleIgnoresVisibility ($ categoryId , $ visibility , $ expectedResult )
32
33
{
33
34
/** @var $session \Magento\Checkout\Model\Session */
34
35
$ session = $ this ->objectManager ->create (\Magento \Checkout \Model \Session::class);
35
36
37
+ // Prepare product with given visibility and category settings
36
38
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
37
39
$ productRepository = $ this ->objectManager ->create (\Magento \Catalog \Api \ProductRepositoryInterface::class);
38
40
/** @var $product \Magento\Catalog\Model\Product */
@@ -41,6 +43,7 @@ public function testValidateCategorySalesRuleIgnoresVisibility($categoryId, $vis
41
43
$ product ->setCategoryIds ([$ categoryId ]);
42
44
$ product ->save ();
43
45
46
+ // Load the SalesRule looking for products in a category and assert that the validation is as expected
44
47
/** @var $rule \Magento\SalesRule\Model\Rule */
45
48
$ rule = $ this ->objectManager ->get (\Magento \Framework \Registry::class)
46
49
->registry ('_fixture/Magento_SalesRule_Category ' );
0 commit comments