public function testGetTtl() { $page = $this->getMock('Sonata\\PageBundle\\Model\\PageInterface'); $block = new Block(); $block->setPage($page); $this->assertFalse($block->hasChildren()); $child1 = $this->getMock('Sonata\\PageBundle\\Model\\BlockInterface'); $child1->expects($this->once())->method('getTtl')->will($this->returnValue(100)); $child2 = $this->getMock('Sonata\\PageBundle\\Model\\BlockInterface'); $child2->expects($this->once())->method('getTtl')->will($this->returnValue(50)); $child3 = $this->getMock('Sonata\\PageBundle\\Model\\BlockInterface'); $child3->expects($this->once())->method('getTtl')->will($this->returnValue(65)); $block->addChildren($child1); $block->addChildren($child2); $block->addChildren($child3); $this->assertEquals(50, $block->getTtl()); $this->assertTrue($block->hasChildren()); }