for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace HeroesofAbenez\Combat;
use Tester\Assert;
require __DIR__ . "/../../bootstrap.php";
/**
* @author Jakub Konečný
* @testCase
*/
final class WeaponTest extends \Tester\TestCase {
public function testIsRanged(): void {
$weaponStats = [
"id" => 1, "name" => "Weapon", "slot" => Equipment::SLOT_WEAPON, "strength" => 1, "worn" => true,
];
foreach(Weapon::MELEE_TYPES as $meleeWeapon) {
$weaponStats["type"] = $meleeWeapon;
$weapon = new Weapon($weaponStats);
Assert::false($weapon->ranged);
}
foreach(Weapon::RANGED_TYPES as $rangedWeapon) {
$weaponStats["type"] = $rangedWeapon;
Assert::true($weapon->ranged);
$test = new WeaponTest();
$test->run();
?>