File tree Expand file tree Collapse file tree 2 files changed +12
-20
lines changed
dev/tests/integration/testsuite/Magento/Catalog
Model/Layer/Filter/Price/_files Expand file tree Collapse file tree 2 files changed +12
-20
lines changed Original file line number Diff line number Diff line change 27
27
$ lastProductId ++;
28
28
}
29
29
30
- $ categoryIds = [3 , 4 ];
31
- foreach ($ categoryIds as $ categoryId ) {
32
- /** @var \Magento\Catalog\Model\Category $category */
33
- $ category = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create ('Magento\Catalog\Model\Category ' );
34
- $ category ->load ($ categoryId );
35
-
36
- if ($ category ->getId ()) {
37
- $ category ->delete ();
38
- }
39
- }
30
+ /** @var \Magento\Catalog\Model\Resource\Product\Collection $collection */
31
+ $ collection = $ objectManager ->create ('Magento\Catalog\Model\Resource\Category\Collection ' );
32
+ $ collection
33
+ ->addAttributeToFilter ('level ' , 2 )
34
+ ->load ()
35
+ ->delete ();
40
36
41
37
$ registry ->unregister ('isSecureArea ' );
42
38
$ registry ->register ('isSecureArea ' , false );
Original file line number Diff line number Diff line change 23
23
}
24
24
}
25
25
26
- $ defaultCategoryIds = [1 , 2 ];
27
- /** @var \Magento\Catalog\Model\Category $category */
28
- $ category = $ objectManager ->create ('Magento\Catalog\Model\Category ' );
29
- /** @var \Magento\Catalog\Model\Category[] $categories */
30
- $ categories = $ category ->getCollection ()->getItems ();
31
- foreach ($ categories as $ category ) {
32
- if ($ category ->getId () && !in_array ($ category ->getId (), $ defaultCategoryIds )) {
33
- $ category ->delete ();
34
- }
35
- }
26
+ /** @var \Magento\Catalog\Model\Resource\Product\Collection $collection */
27
+ $ collection = $ objectManager ->create ('Magento\Catalog\Model\Resource\Category\Collection ' );
28
+ $ collection
29
+ ->addAttributeToFilter ('level ' , 2 )
30
+ ->load ()
31
+ ->delete ();
36
32
37
33
$ registry ->unregister ('isSecureArea ' );
38
34
$ registry ->register ('isSecureArea ' , false );
You can’t perform that action at this time.
0 commit comments