File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
dev/tests/integration/testsuite/Magento/Bundle/Model/Category Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -208,18 +208,28 @@ public function testCategoryCreate()
208
208
}
209
209
210
210
/**
211
+ * Finds 4 categories
212
+ *
211
213
* @return Category[]
212
214
*/
213
215
private function getCategories ()
214
216
{
215
- /** @var Category $category */
216
- $ category = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
217
- \Magento \Catalog \Model \Category::class
217
+ $ collectionFactory = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
218
+ \Magento \Catalog \Model \ResourceModel \Category \CollectionFactory::class
218
219
);
219
220
220
- $ result = $ category ->getCollection ()->addAttributeToSelect ('name ' )->getItems ();
221
- $ result = array_slice ($ result , 2 );
221
+ /** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
222
+ $ collection = $ collectionFactory ->create ();
223
+
224
+ $ collection
225
+ ->addAttributeToSelect ('name ' )
226
+ ->addAttributeToFilter ('name ' , ['in ' => [
227
+ 'Category 1 ' ,
228
+ 'Category 2 ' ,
229
+ 'Category 3 ' ,
230
+ 'Category 4 ' ,
231
+ ]]);
222
232
223
- return array_slice ( $ result , 0 , 4 );
233
+ return array_values ( $ collection -> getItems () );
224
234
}
225
235
}
You can’t perform that action at this time.
0 commit comments