/** * @test * @dataProvider provideBackgroundPointsWithHeritage * @param int $spentBackgroundPoints * @param string $expectedHeritageName */ public function I_can_get_heritage_name_by_background_points($spentBackgroundPoints, $expectedHeritageName) { $heritage = Heritage::getIt($spentBackgroundPoints); self::assertSame($spentBackgroundPoints, $heritage->getValue()); self::assertSame($spentBackgroundPoints, $heritage->getSpentBackgroundPoints()); self::assertSame($expectedHeritageName, $heritage->getHeritageName()); }
/** * @param ExceptionalityFate $exceptionalityFate , * @param int $forHeritageSpentBackgroundPoints , * @param int $forBackgroundSkillPointsSpentBackgroundPoints * @param int $forBelongingsSpentBackgroundPoints * @return Background */ public static function createIt(ExceptionalityFate $exceptionalityFate, $forHeritageSpentBackgroundPoints, $forBackgroundSkillPointsSpentBackgroundPoints, $forBelongingsSpentBackgroundPoints) { $backgroundPoints = BackgroundPoints::getIt($exceptionalityFate); $heritage = Heritage::getIt($forHeritageSpentBackgroundPoints); $backgroundSkillPoints = BackgroundSkillPoints::getIt($forBackgroundSkillPointsSpentBackgroundPoints, $heritage); $belongingsValue = BelongingsValue::getIt($forBelongingsSpentBackgroundPoints, $heritage); return new static($backgroundPoints, $heritage, $backgroundSkillPoints, $belongingsValue); }
private static function createCombinedSkillEntities(Tables $tables, ProfessionFirstLevel $firstLevel) { $combinedSkillClasses = self::getListOfSkillClasses(CombinedSkill::class); $combinedSkillPoint = CombinedSkillPoint::createFromFirstLevelBackgroundSkillPoints($firstLevel, BackgroundSkillPoints::getIt(3, Heritage::getIt(5)), $tables); $requiredRankValue = new PositiveIntegerObject(1); $combinedSkillList = array_map(function ($combinedSkillClass) use($firstLevel, $combinedSkillPoint, $requiredRankValue) { /** @var CombinedSkill $combinedSkill */ $combinedSkill = new $combinedSkillClass($firstLevel); $combinedSkill->addSkillRank($combinedSkillPoint); return $combinedSkill; }, $combinedSkillClasses); $combinedSkills = new CombinedSkills(); foreach ($combinedSkillList as $combinedSkill) { $combinedSkills->addCombinedSkill($combinedSkill); } $combinedSkillPoint = CombinedSkillPoint::createFromFirstLevelBackgroundSkillPoints($firstLevel, BackgroundSkillPoints::getIt(3, Heritage::getIt(5)), $tables); $combinedSkillRank = new CombinedSkillRank(new Cooking($firstLevel), CombinedSkillPoint::createFromFirstLevelBackgroundSkillPoints($firstLevel, BackgroundSkillPoints::getIt(4, Heritage::getIt(5)), $tables), new PositiveIntegerObject(1)); return array_merge($combinedSkillList, [$combinedSkills, $combinedSkillPoint, $combinedSkillRank]); }