public function testGetTtl() { $block = new Block(); $this->assertFalse($block->hasChildren()); $child1 = $this->getMockBuilder('Sonata\\BlockBundle\\Model\\Block')->getMock(); $child1->expects($this->once())->method('getTtl')->will($this->returnValue(100)); $child2 = $this->getMockBuilder('Sonata\\BlockBundle\\Model\\Block')->getMock(); $child2->expects($this->once())->method('getTtl')->will($this->returnValue(50)); $child3 = $this->getMockBuilder('Sonata\\BlockBundle\\Model\\Block')->getMock(); $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()); }