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()); }
/** * Builds the block * * @param string $id */ protected function buildBlock($id) { $blockType = $this->rawLayout->getProperty($id, RawLayout::BLOCK_TYPE, true); $options = $this->rawLayout->getProperty($id, RawLayout::OPTIONS, true); $types = $this->typeHelper->getTypes($blockType); // resolve options $resolvedOptions = $this->optionsResolver->resolveOptions($blockType, $options); $this->rawLayout->setProperty($id, RawLayout::RESOLVED_OPTIONS, $resolvedOptions); // point the block builder state to the current block $this->blockBuilder->initialize($id); // iterate from parent to current foreach ($types as $type) { $type->buildBlock($this->blockBuilder, $resolvedOptions); $this->registry->buildBlock($type->getName(), $this->blockBuilder, $resolvedOptions); } }