Example #1
0
 /**
  * @covers BackBee\NestedNode\Page::getParentZoneAtSamePositionIfExists
  */
 public function testGetParentZoneAtSamePositionIfExists()
 {
     $page = new Page('test', array('title' => 'title', 'url' => 'url'));
     $page->setLayout(self::$kernel->createLayout('test'));
     $this->assertFalse($this->page->getParentZoneAtSamePositionIfExists($page->getContentSet()->first()));
     $this->assertFalse($this->page->getParentZoneAtSamePositionIfExists($page->getContentSet()->last()));
     $child = new Page('child', array('title' => 'child', 'url' => 'url'));
     $child->setParent($page)->setLayout($page->getLayout());
     $this->assertFalse($child->getParentZoneAtSamePositionIfExists(new ContentSet()));
     $this->assertEquals($page->getContentSet()->first(), $child->getParentZoneAtSamePositionIfExists($child->getContentSet()->first()));
     $this->assertEquals($page->getContentSet()->last(), $child->getParentZoneAtSamePositionIfExists($child->getContentSet()->last()));
     $thirdcolumn = new \stdClass();
     $thirdcolumn->id = 'third';
     $thirdcolumn->defaultContainer = null;
     $thirdcolumn->target = '#target';
     $thirdcolumn->gridClassPrefix = 'row';
     $thirdcolumn->gridSize = 4;
     $thirdcolumn->mainZone = false;
     $thirdcolumn->defaultClassContent = 'inherited';
     $thirdcolumn->options = null;
     $data = self::$kernel->getDefaultLayoutZones();
     $data->templateLayouts[] = $thirdcolumn;
     $layout = new Layout();
     $child->setLayout($layout->setDataObject($data));
     $this->assertEquals($page->getContentSet()->last(), $child->getParentZoneAtSamePositionIfExists($child->getContentSet()->item(1)));
     $this->assertFalse($child->getParentZoneAtSamePositionIfExists($child->getContentSet()->last()));
 }