/** * @test * @dataProvider provideStrengthAndRangedWeaponGroup * @param int $requiredStrength * @param int $strength * @param mixed $expectedMissingStrength * @param string $weaponGroup */ public function I_can_get_missing_strength_and_sanction_values_for_range_weapon($requiredStrength, $strength, $expectedMissingStrength, $weaponGroup) { $armourer = new Armourer($tables = $this->createTables()); $tables->shouldReceive('getArmamentsTableByArmamentCode')->andReturn($rangedWeaponsTable = $this->createRangedWeaponsTable()); $weaponlikeCode = $this->createRangedWeaponCode('foo', $weaponGroup); $rangedWeaponsTable->shouldReceive('getRequiredStrengthOf')->with($weaponlikeCode)->andReturn($requiredStrength); self::assertSame($expectedMissingStrength, $armourer->getMissingStrengthForArmament($weaponlikeCode, Strength::getIt($strength), $this->createSize())); $tables->shouldReceive('getArmamentStrengthSanctionsTableByCode')->andReturn($rangeWeaponSanctionsTable = $this->createRangedWeaponSanctionsTable()); $rangeWeaponSanctionsTable->shouldReceive('canUseIt')->with($expectedMissingStrength)->andReturn('bazbaz'); self::assertSame('bazbaz', $armourer->canUseArmament($weaponlikeCode, Strength::getIt($strength), $this->createSize())); $tables->shouldReceive('getWeaponlikeStrengthSanctionsTableByCode')->andReturn($rangeWeaponSanctionsTable); $rangeWeaponSanctionsTable->shouldReceive('getFightNumberSanction')->with($expectedMissingStrength)->andReturn('baz'); self::assertSame('baz', $armourer->getFightNumberMalusByStrengthWithWeaponOrShield($weaponlikeCode, Strength::getIt($strength))); $rangeWeaponSanctionsTable->shouldReceive('getAttackNumberSanction')->with($expectedMissingStrength)->andReturn('qux'); self::assertSame('qux', $armourer->getAttackNumberMalusByStrengthWithWeaponlike($weaponlikeCode, Strength::getIt($strength))); $rangeWeaponSanctionsTable->shouldReceive('getDefenseNumberSanction')->with($expectedMissingStrength)->andReturn('bar bar'); self::assertSame('bar bar', $armourer->getDefenseNumberMalusByStrengthWithWeaponOrShield($weaponlikeCode, Strength::getIt($strength))); $tables->shouldReceive('getRangedWeaponStrengthSanctionsTable')->andReturn($rangeWeaponSanctionsTable); $rangeWeaponSanctionsTable->shouldReceive('getLoadingInRounds')->with($expectedMissingStrength)->andReturn('foobar'); self::assertSame('foobar', $armourer->getLoadingInRoundsByStrengthWithRangedWeapon($weaponlikeCode, Strength::getIt($strength))); $rangeWeaponSanctionsTable->shouldReceive('getLoadingInRoundsSanction')->with($expectedMissingStrength)->andReturn('foobaz'); self::assertSame('foobaz', $armourer->getLoadingInRoundsMalusByStrengthWithRangedWeapon($weaponlikeCode, Strength::getIt($strength))); $rangeWeaponSanctionsTable->shouldReceive('getBaseOfWoundsSanction')->with($expectedMissingStrength)->andReturn('foobarbar'); self::assertSame('foobarbar', $armourer->getBaseOfWoundsMalusByStrengthWithWeaponlike($weaponlikeCode, Strength::getIt($strength))); }