public function testItCallsCalendarFunctions() { foreach (array('year', 'month', 'week', 'day') as $periodName) { $period = $this->getMock('CalendR\\Perdiod\\PeriodInterface'); $this->calendar->expects($this->once())->method('get' . ucfirst($periodName))->with('foo', 'bar')->will($this->returnValue($period)); $this->assertSame($period, $this->object->{'get' . ucfirst($periodName)}('foo', 'bar')); } $events = array($this->getMock('CalendR\\Event\\EventInterface')); $period = $this->getMock('CalendR\\Period\\PeriodInterface'); $this->calendar->expects($this->once())->method('getEvents')->with($period)->will($this->returnValue($events)); $this->assertSame($events, $this->object->getEvents($period)); }