Ejemplo n.º 1
0
 public function testGetTypeNameWhenBlockTypeIsAddedAsObject()
 {
     $id = 'test_id';
     $name = 'test_name';
     $type = $this->getMock('Oro\\Component\\Layout\\BlockTypeInterface');
     $type->expects($this->once())->method('getName')->will($this->returnValue($name));
     $this->rawLayout->add($id, null, $type);
     $this->blockBuilder->initialize($id);
     $this->assertEquals($name, $this->blockBuilder->getTypeName());
 }
Ejemplo n.º 2
0
 public function testGetOptions()
 {
     $this->rawLayout->add('root', null, 'root', ['root_option1' => 'val1']);
     $this->rawLayout->setProperty('root', RawLayout::RESOLVED_OPTIONS, ['root_option1' => 'val1', 'id' => 'root']);
     $this->rawLayout->add('header', 'root', 'header', ['header_option1' => 'val1']);
     $this->rawLayout->setProperty('header', RawLayout::RESOLVED_OPTIONS, ['header_option1' => 'val1', 'id' => 'header']);
     $this->block->initialize('header');
     $this->assertEquals(['header_option1' => 'val1', 'id' => 'header'], $this->block->getOptions());
     $this->assertEquals(['root_option1' => 'val1', 'id' => 'root'], $this->block->getParent()->getOptions());
 }
Ejemplo n.º 3
0
 public function testGetHierarchyIterator()
 {
     // prepare test data
     $this->rawLayout->add('root', null, 'root');
     $this->rawLayout->add('header', 'root', 'header');
     $this->rawLayout->add('item1', 'root', 'label');
     $this->rawLayout->add('item2', 'header', 'label');
     // do test
     $this->assertSame(['header' => 'header', 'item2' => 'item2', 'item1' => 'item1'], iterator_to_array($this->rawLayout->getHierarchyIterator('root')));
     $this->assertSame(['item2' => 'item2'], iterator_to_array($this->rawLayout->getHierarchyIterator('header')));
     $this->assertSame([], iterator_to_array($this->rawLayout->getHierarchyIterator('item2')));
 }