Item: restrict bounds of count to 0-255

This commit is contained in:
Dylan K. Taylor
2020-02-23 17:23:53 +00:00
parent 46ac4cbca1
commit 10317527e4
2 changed files with 18 additions and 0 deletions

View File

@ -89,4 +89,18 @@ class ItemTest extends TestCase{
self::assertEquals($id, $item->getId());
self::assertEquals($meta, $item->getDamage());
}
public function testSetCountTooBig() : void{
$this->expectException(\InvalidArgumentException::class);
$item = ItemFactory::get(ItemIds::STONE);
$item->setCount(256);
}
public function testSetCountTooSmall() : void{
$this->expectException(\InvalidArgumentException::class);
$item = ItemFactory::get(ItemIds::STONE);
$item->setCount(-1);
}
}