Item-from-string parsing no longer depends on ItemIds

after this is done I'm banning the constant() function.
This commit is contained in:
Dylan K. Taylor
2020-05-13 00:17:15 +01:00
parent ec13aa659a
commit 11ef9fb0c0
9 changed files with 996 additions and 77 deletions

View File

@ -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
*/