/** * @test * @depends I_can_get_race * @param Race $race * @throws \LogicException */ public function I_can_get_non_base_property(Race $race) { $tables = new Tables(); $racesTable = $tables->getRacesTable(); $distanceTable = $tables->getDistanceTable(); foreach ($this->getGenders() as $genderCode) { foreach ($this->getNonBaseNonDerivedPropertyCodes() as $propertyCode) { $sameValueByGenericGetter = $race->getProperty($propertyCode, $genderCode, $tables); switch ($propertyCode) { case PropertyCode::SENSES: $value = $race->getSenses($racesTable); break; case PropertyCode::TOUGHNESS: $value = $race->getToughness($racesTable); break; case PropertyCode::SIZE: $value = $race->getSize($genderCode, $tables); break; case PropertyCode::WEIGHT: $value = $race->getWeight($genderCode, $tables); break; case PropertyCode::WEIGHT_IN_KG: $value = $race->getWeightInKg($genderCode, $tables); break; case PropertyCode::HEIGHT_IN_CM: $value = $race->getHeightInCm($racesTable); break; case PropertyCode::HEIGHT: $value = $race->getHeight($racesTable, $distanceTable); break; case PropertyCode::INFRAVISION: $value = $race->hasInfravision($racesTable); break; case PropertyCode::NATIVE_REGENERATION: $value = $race->hasNativeRegeneration($racesTable); break; case PropertyCode::REQUIRES_DM_AGREEMENT: $value = $race->requiresDmAgreement($racesTable); break; case PropertyCode::REMARKABLE_SENSE: $value = $race->getRemarkableSense($racesTable); break; case PropertyCode::AGE: $value = $race->getAge($racesTable); break; default: throw new \LogicException("Unexpected property {$propertyCode} for {$race->getSubraceCode()} {$race->getRaceCode()} {$genderCode}"); } if ($propertyCode === PropertyCode::WEIGHT) { $expectedOtherProperty = $this->getExpectedWeight($genderCode, $tables->getWeightTable()); } else { $expectedOtherProperty = $this->getExpectedOtherProperty($propertyCode, $genderCode->getValue()); } self::assertEquals($expectedOtherProperty, $value, "Unexpected {$propertyCode} of {$race->getSubraceCode()} {$race->getRaceCode()} {$genderCode}"); self::assertSame($sameValueByGenericGetter, $value); } } }