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()
208208 }
209209
210210 /**
211+ * Finds 4 categories
212+ *
211213 * @return Category[]
212214 */
213215 private function getCategories ()
214216 {
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
218219 );
219220
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+ ]]);
222232
223- return array_slice ( $ result , 0 , 4 );
233+ return array_values ( $ collection -> getItems () );
224234 }
225235}
You can’t perform that action at this time.
0 commit comments