Merge branch 'minor-next' into stable

This commit is contained in:
Dylan K. Taylor
2023-07-04 14:43:23 +01:00
49 changed files with 1552 additions and 565 deletions

View File

@ -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");
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\item;
use PHPUnit\Framework\TestCase;
use pocketmine\utils\Utils;
use function array_unique;
use function max;
@ -43,4 +44,17 @@ class ItemTypeIdsTest extends TestCase{
self::assertSameSize($idTable, array_unique($idTable), "Every ItemTypeID must be unique");
}
public function testVanillaItemsParity() : void{
$reflect = new \ReflectionClass(ItemTypeIds::class);
foreach(Utils::stringifyKeys(VanillaItems::getAll()) as $name => $item){
if($item instanceof ItemBlock){
continue;
}
$expected = $item->getTypeId();
$actual = $reflect->getConstant($name);
self::assertSame($expected, $actual, "VanillaItems::$name() type ID does not match ItemTypeIds::$name");
}
}
}