/** * @covers YAYOG\History::addWorkout */ public function testAddWorkoutSetsPreviousWorkout() { $workout1 = new Workout(); $workout1->setProgram('Basic')->setDay(4); $workout2 = new Workout(); $workout2->setProgram('Basic')->setDay(4); $workout3 = new Workout(); $workout3->setProgram('Basic')->setDay(6); $workouts = array($workout1, $workout2, $workout3); foreach ($workouts as $workout) { $this->history->addWorkout($workout); } $this->assertNull($workout1->getPreviousWorkout()); $this->assertNull($workout3->getPreviousWorkout()); $this->assertSame($workout1, $workout2->getPreviousWorkout()); }
/** * @covers YAYOG\Workout::setPreviousWorkout * @covers YAYOG\Workout::getPreviousWorkout */ public function testSetPreviousWorkout() { $prevWorkout = new Workout(); $this->workout->setPreviousWorkout($prevWorkout); $this->assertSame($prevWorkout, $this->workout->getPreviousWorkout()); }