Exemplo n.º 1
0
 public function testBlockEvent()
 {
     $blockEvent = new BlockEvent();
     $this->assertEmpty($blockEvent->getSettings());
     $blockEvent->addBlock($this->getMock('Sonata\\BlockBundle\\Model\\BlockInterface'));
     $this->assertCount(1, $blockEvent->getBlocks());
     $blockEvent->addBlock($this->getMock('Sonata\\BlockBundle\\Model\\BlockInterface'));
     $this->assertCount(2, $blockEvent->getBlocks());
     $this->assertNull($blockEvent->getSetting('fake'));
     $this->assertEquals(1, $blockEvent->getSetting('fake', 1));
 }
Exemplo n.º 2
0
 /**
  * @param BlockEvent $event
  *
  * @return array
  */
 protected function getEventBlocks(BlockEvent $event)
 {
     $results = array();
     foreach ($event->getBlocks() as $block) {
         $results[] = array($block->getId(), $block->getType());
     }
     return $results;
 }