mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 08:35:20 +00:00
Convert ItemFactory to singleton
This commit is contained in:
@ -29,16 +29,12 @@ use pocketmine\item\ItemIds;
|
||||
|
||||
class BaseInventoryTest extends TestCase{
|
||||
|
||||
public static function setUpBeforeClass() : void{
|
||||
ItemFactory::init();
|
||||
}
|
||||
|
||||
public function testAddItemDifferentUserData() : void{
|
||||
$inv = new class(1) extends BaseInventory{
|
||||
|
||||
};
|
||||
$item1 = ItemFactory::get(ItemIds::ARROW, 0, 1);
|
||||
$item2 = ItemFactory::get(ItemIds::ARROW, 0, 1)->setCustomName("TEST");
|
||||
$item1 = ItemFactory::getInstance()->get(ItemIds::ARROW, 0, 1);
|
||||
$item2 = ItemFactory::getInstance()->get(ItemIds::ARROW, 0, 1)->setCustomName("TEST");
|
||||
|
||||
$inv->addItem(clone $item1);
|
||||
self::assertFalse($inv->canAddItem($item2), "Item WITHOUT userdata should not stack with item WITH userdata");
|
||||
|
Reference in New Issue
Block a user