From f8547ad57c8040081a0dac56f00214ba622bec57 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 30 Jun 2022 16:39:50 +0100 Subject: [PATCH] LegacyStringToItemParserTest: do not rely on the presence of legacy ID and meta in the API --- .../item/LegacyStringToItemParserTest.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/item/LegacyStringToItemParserTest.php b/tests/phpunit/item/LegacyStringToItemParserTest.php index 50d73a438..04930ff81 100644 --- a/tests/phpunit/item/LegacyStringToItemParserTest.php +++ b/tests/phpunit/item/LegacyStringToItemParserTest.php @@ -24,31 +24,31 @@ declare(strict_types=1); namespace pocketmine\item; use PHPUnit\Framework\TestCase; +use pocketmine\block\VanillaBlocks; class LegacyStringToItemParserTest extends TestCase{ /** * @return mixed[][] - * @phpstan-return list + * @phpstan-return list */ 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] + ["dye:4", VanillaItems::LAPIS_LAZULI()], + ["351", VanillaItems::INK_SAC()], + ["351:4", VanillaItems::LAPIS_LAZULI()], + ["stone:3", VanillaBlocks::DIORITE()->asItem()], + ["minecraft:string", VanillaItems::STRING()], + ["diamond_pickaxe", VanillaItems::DIAMOND_PICKAXE()] ]; } /** * @dataProvider itemFromStringProvider */ - public function testFromStringSingle(string $string, int $id, int $meta) : void{ + public function testFromStringSingle(string $string, Item $expected) : void{ $item = LegacyStringToItemParser::getInstance()->parse($string); - self::assertEquals($id, $item->getId()); - self::assertEquals($meta, $item->getMeta()); + self::assertTrue($item->equals($expected)); } }