mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 01:16:15 +00:00
Item-from-string parsing no longer depends on ItemIds
after this is done I'm banning the constant() function.
This commit is contained in:
@ -37,35 +37,6 @@ class ItemFactoryTest extends TestCase{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[][]
|
||||
* @phpstan-return list<array{string,int,int}>
|
||||
*/
|
||||
public function itemFromStringProvider() : array{
|
||||
return [
|
||||
["dye:4", ItemIds::DYE, 4],
|
||||
["351", ItemIds::DYE, 0],
|
||||
["351:4", ItemIds::DYE, 4],
|
||||
["stone:3", ItemIds::STONE, 3],
|
||||
["minecraft:string", ItemIds::STRING, 0],
|
||||
["diamond_pickaxe", ItemIds::DIAMOND_PICKAXE, 0],
|
||||
["diamond_pickaxe:5", ItemIds::DIAMOND_PICKAXE, 5]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider itemFromStringProvider
|
||||
* @param string $string
|
||||
* @param int $id
|
||||
* @param int $meta
|
||||
*/
|
||||
public function testFromStringSingle(string $string, int $id, int $meta) : void{
|
||||
$item = ItemFactory::getInstance()->fromString($string);
|
||||
|
||||
self::assertEquals($id, $item->getId());
|
||||
self::assertEquals($meta, $item->getMeta());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that durable items are correctly created by the item factory
|
||||
*/
|
||||
|
Reference in New Issue
Block a user