Convert ItemFactory to singleton

This commit is contained in:
Dylan K. Taylor
2020-04-24 00:18:31 +01:00
parent 13d784cd0c
commit 5a94af40e2
19 changed files with 546 additions and 546 deletions

View File

@ -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");