mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
Add test for whether item retains it's display properties after deserialization (#3047)
This commit is contained in:
parent
b5b4133c5d
commit
a8fa3ba434
@ -62,6 +62,21 @@ class ItemTest extends TestCase{
|
||||
self::assertTrue($item1->equals($item2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether items retain their display properties
|
||||
* after being deserialized
|
||||
*/
|
||||
public function testItemPersistsDisplayProperties() : void{
|
||||
$lore = ["Line A", "Line B"];
|
||||
$name = "HI";
|
||||
$item = ItemFactory::get(Item::DIAMOND_SWORD);
|
||||
$item->setCustomName($name);
|
||||
$item->setLore($lore);
|
||||
$item = Item::nbtDeserialize($item->nbtSerialize());
|
||||
self::assertTrue($item->getCustomName() === $name);
|
||||
self::assertTrue($item->getLore() === $lore);
|
||||
}
|
||||
|
||||
public function testHasEnchantment() : void{
|
||||
$this->item->addEnchantment(new EnchantmentInstance(Enchantment::EFFICIENCY(), 5));
|
||||
self::assertTrue($this->item->hasEnchantment(Enchantment::EFFICIENCY()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user