예제 #1
0
 /**
  * @param string $type
  * @param string $trainingType
  *
  * @return Week
  */
 public function build($type, $trainingType)
 {
     $week = new Week();
     $sessions = $this->weekProvider->getSessionByWeekType($type, $trainingType);
     foreach ($sessions as $session) {
         if ($session instanceof AbstractSession) {
             $week->addSession($session);
         }
     }
     return $week;
 }
 function it_build_a_plan(Plan $plan, TrainingTypeManager $trainingTypeManager, WeekBuilder $weekBuilder, Week $week, AbstractSession $session)
 {
     $plan->getTrainingType()->willReturn(10);
     $plan->getNbWeek()->willReturn(1);
     $plan->getWeekType()->willReturn('week_3');
     $week->getSessions()->willReturn(array($session));
     $weekBuilder->build('week_3', 10)->willReturn($week);
     $plan->addWeek($week)->shouldBeCalled();
     $trainingTypeManager->findAll()->willReturn(array(10, 21, 42));
     $this->build($plan);
 }