mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 01:16:15 +00:00
Tests: verify that ItemTypeIds/BlockTypeIds constants match their corresponding VanillaItems/VanillaBlocks registrations
This commit is contained in:
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use pocketmine\utils\Utils;
|
||||
use function array_unique;
|
||||
use function max;
|
||||
|
||||
@ -43,4 +44,14 @@ class BlockTypeIdsTest extends TestCase{
|
||||
|
||||
self::assertSameSize($idTable, array_unique($idTable), "Every BlockTypeID must be unique");
|
||||
}
|
||||
|
||||
public function testVanillaBlocksParity() : void{
|
||||
$reflect = new \ReflectionClass(BlockTypeIds::class);
|
||||
|
||||
foreach(Utils::stringifyKeys(VanillaBlocks::getAll()) as $name => $block){
|
||||
$expected = $block->getTypeId();
|
||||
$actual = $reflect->getConstant($name);
|
||||
self::assertSame($expected, $actual, "VanillaBlocks::$name() does not match BlockTypeIds::$name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user