/**
  * @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());
 }
 private function sumSpentPoints(Heritage $heritage, BackgroundSkillPoints $backgroundSkillPoints, BelongingsValue $belongingsValue)
 {
     return $heritage->getSpentBackgroundPoints() + $backgroundSkillPoints->getSpentBackgroundPoints() + $belongingsValue->getSpentBackgroundPoints();
 }
 protected static function checkBackgroundPointsAgainstHeritage($spentBackgroundPoints, Heritage $heritage)
 {
     if ($spentBackgroundPoints > $heritage->getSpentBackgroundPoints() + self::MAX_POINTS_OVER_HERITAGE) {
         throw new Exceptions\TooMuchSpentBackgroundPoints(static::class . ' can not get more points than' . ' heritage background points + max used background points over those of heritage ' . '(' . $heritage->getSpentBackgroundPoints() . ' + ' . self::MAX_POINTS_OVER_HERITAGE . ')' . ' = ' . ($heritage->getSpentBackgroundPoints() + self::MAX_POINTS_OVER_HERITAGE) . ', got ' . $spentBackgroundPoints);
     }
 }
 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]);
 }