Exemplo n.º 1
0
 public function testGetSiblings()
 {
     $p = \XLite\Core\Database::getRepo('XLite\\Model\\Category')->find(1);
     $c1 = new \XLite\Model\Category();
     $c1->map($this->categoryData);
     $p->addChildren($c1);
     $c2 = new \XLite\Model\Category();
     $c2->map($this->categoryData);
     $p->addChildren($c2);
     $em = \XLite\Core\Database::getEM();
     $em->flush();
     $found = false;
     foreach ($c1->getSiblings() as $s) {
         if ($s->getCategoryId() == $c2->getCategoryId()) {
             $found = true;
         }
     }
     $this->assertTrue($found, 'sibling category is not found');
     $em->remove($c1);
     $em->remove($c2);
     $em->flush();
 }