コード例 #1
0
 public function testGetChildrenIds()
 {
     $this->registry->getManagerForClass('OroB2BCatalogBundle:Category')->clear();
     /** @var Category $category */
     $categories = $this->repository->findAll();
     $parent = $this->findCategoryByTitle($categories, LoadCategoryData::FIRST_LEVEL);
     $childrenId1 = $this->findCategoryByTitle($categories, LoadCategoryData::SECOND_LEVEL1)->getId();
     $childrenId2 = $this->findCategoryByTitle($categories, LoadCategoryData::THIRD_LEVEL1)->getId();
     $childrenId3 = $this->findCategoryByTitle($categories, LoadCategoryData::THIRD_LEVEL2)->getId();
     $result = $this->repository->getChildrenIds($parent);
     $this->assertEquals($result, [$childrenId1, $childrenId2, $childrenId3]);
 }