示例#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());
 }
示例#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());
 }
示例#3
0
 /**
  * @dataProvider             emptyStringDataProvider
  *
  * @expectedException \Oro\Component\Layout\Exception\InvalidArgumentException
  * @expectedExceptionMessage The item id must not be empty.
  */
 public function testGetHierarchyIteratorWithEmptyId($id)
 {
     $this->rawLayout->getHierarchyIterator($id);
 }
 /**
  * {@inheritdoc}
  */
 public function removeOption($id, $optionName)
 {
     $options = $this->rawLayout->getProperty($id, RawLayout::OPTIONS);
     $this->propertyAccessor->remove($options, $this->getPropertyPath($optionName));
     $this->rawLayout->setProperty($id, RawLayout::OPTIONS, $options);
 }
示例#5
0
 /**
  * Checks whether the given block is a container for other blocks
  *
  * @param string $id
  *
  * @return bool
  */
 protected function isContainerBlock($id)
 {
     return $this->typeHelper->isInstanceOf($this->rawLayout->getProperty($id, RawLayout::BLOCK_TYPE, true), ContainerType::NAME);
 }