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));
 }
Esempio 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;
 }