Passed
Push — master ( bc69e6...465240 )
by Jakub
12:35
created

WeaponTest::testIsRanged()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 13
rs 9.9332
c 0
b 0
f 0
cc 3
nc 4
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace HeroesofAbenez\Combat;
5
6
use Tester\Assert;
7
8
require __DIR__ . "/../../bootstrap.php";
9
10
/**
11
 * @author Jakub Konečný
12
 * @testCase
13
 */
14
final class WeaponTest extends \Tester\TestCase {
15
  public function testIsRanged(): void {
16
    $weaponStats = [
17
      "id" => 1, "name" => "Weapon", "slot" => Equipment::SLOT_WEAPON, "strength" => 1, "worn" => true,
18
    ];
19
    foreach(Weapon::MELEE_TYPES as $meleeWeapon) {
20
      $weaponStats["type"] = $meleeWeapon;
21
      $weapon = new Weapon($weaponStats);
22
      Assert::false($weapon->ranged);
23
    }
24
    foreach(Weapon::RANGED_TYPES as $rangedWeapon) {
25
      $weaponStats["type"] = $rangedWeapon;
26
      $weapon = new Weapon($weaponStats);
27
      Assert::true($weapon->ranged);
28
    }
29
  }
30
}
31
32
$test = new WeaponTest();
33
$test->run();
34
?>