mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 08:35:20 +00:00
Fixed InventoryHelpersTrait::addItem() cannot add items with a count greater than maxstack (#4283)
This commit is contained in:
@ -85,4 +85,19 @@ class BaseInventoryTest extends TestCase{
|
||||
}
|
||||
self::assertSame(20, $leftoverCount);
|
||||
}
|
||||
|
||||
public function testAddItemWithOversizedCount() : void{
|
||||
$inventory = new class(10) extends SimpleInventory{
|
||||
|
||||
};
|
||||
$leftover = $inventory->addItem(VanillaItems::APPLE()->setCount(100));
|
||||
self::assertCount(0, $leftover);
|
||||
|
||||
$count = 0;
|
||||
foreach($inventory->getContents() as $item){
|
||||
self::assertTrue($item->equals(VanillaItems::APPLE()));
|
||||
$count += $item->getCount();
|
||||
}
|
||||
self::assertSame(100, $count);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user