Example #1
0
 public function testFromObject()
 {
     $itemStack = ItemStack::fromObject((object) ['id' => 42, 'count' => 1337, 'foo' => 'bar']);
     $this->assertEquals(42, $itemStack->id);
     $this->assertEquals(1337, $itemStack->count);
     $this->assertEquals('bar', $itemStack->foo);
 }
 public function testItemChatLinkEncodeUpgrades()
 {
     $itemStack = ItemStack::fromArray(['count' => 1, 'id' => 46762, 'skin' => 3709, 'upgrades' => [24575, 24615]]);
     $chatlink = new ItemChatlink($itemStack);
     $chatcode = $chatlink->encode();
     $this->assertEquals('[&AgGqtgDgfQ4AAP9fAAAnYAAA]', $chatcode, 'ItemChatlink should encode the ItemStack correctly');
 }