/** * @param Strength $strength * @param RaceCode $raceCode * @param SubRaceCode $subraceCode * @param RacesTable $racesTable */ public function __construct(Strength $strength, RaceCode $raceCode, SubRaceCode $subraceCode, RacesTable $racesTable) { /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ parent::__construct($strength->getValue() + $racesTable->getToughness($raceCode, $subraceCode)); }
/** * @param RacesTable $racesTable * @return int */ public function getToughness(RacesTable $racesTable) { /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ return $racesTable->getToughness($this->getRaceCode(), $this->getSubraceCode()); }
/** * @test * @dataProvider provideToughnessOfRace * * @param string $race * @param string $subrace * @param int $toughness */ public function I_can_get_toughness_of_any_race($race, $subrace, $toughness) { $racesTable = new RacesTable(); self::assertSame($toughness, $racesTable->getToughness(RaceCode::getIt($race), SubRaceCode::getIt($subrace))); }