/** * @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); }
/** * @test * @dataProvider provideBackgroundPointsHeritageAndPrice * @param int $spentBackgroundPoints * @param int $heritageValue * @param int $expectedPrice */ public function I_can_get_belongings_price($spentBackgroundPoints, $heritageValue, $expectedPrice) { $belongingsValue = BelongingsValue::getIt($spentBackgroundPoints, $heritage = $this->createHeritage($heritageValue)); $price = $belongingsValue->getBelongingsPrice(); self::assertInstanceOf(Price::class, $price); self::assertSame((double) $expectedPrice, $price->getGoldCoins()); self::assertSame((double) $expectedPrice, $price->getValue()); // the base value is in gold already }