Ejemplo n.º 1
0
 /**
  * @covers \BackBee\NestedNode\Repository\PageRepository::getOnlinePrevSibling
  */
 public function testGetOnlinePrevSibling()
 {
     $section1 = $this->repository->find('section1');
     $section2 = $this->repository->find('section2');
     $page1 = $this->repository->find('page1');
     $page2 = $this->repository->find('page2');
     $page3 = $this->repository->find('page3');
     $this->assertNull($this->repository->getOnlinePrevSibling($section1));
     $this->assertNull($this->repository->getOnlinePrevSibling($section2));
     $this->assertNull($this->repository->getOnlinePrevSibling($page1));
     $this->assertNull($this->repository->getOnlinePrevSibling($page2));
     $this->assertNull($this->repository->getOnlinePrevSibling($page3));
     $section2->setState(Page::STATE_ONLINE);
     $section1->setState(Page::STATE_ONLINE);
     $page1->setState(Page::STATE_ONLINE);
     $page2->setState(Page::STATE_ONLINE);
     $page3->setState(Page::STATE_ONLINE);
     self::$em->flush();
     $this->assertEquals($section2, $this->repository->getOnlinePrevSibling($section1));
     $this->assertNull($this->repository->getOnlinePrevSibling($section2));
     $this->assertEquals($page2, $this->repository->getOnlinePrevSibling($page1));
     $this->assertNull($this->repository->getOnlinePrevSibling($page2));
     $this->assertEquals($section1, $this->repository->getOnlinePrevSibling($page3));
 }