mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Added unit test to verify all VanillaBlocks serialize and deserialize correctly
This commit is contained in:
parent
cb97f37d13
commit
7769857f6a
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\blockstate\convert;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use pocketmine\block\VanillaBlocks;
|
||||
|
||||
final class BlockSerializerDeserializerTest extends TestCase{
|
||||
private BlockStateToBlockObjectDeserializer $deserializer;
|
||||
private BlockObjectToBlockStateSerializer $serializer;
|
||||
|
||||
public function setUp() : void{
|
||||
$this->deserializer = new BlockStateToBlockObjectDeserializer();
|
||||
$this->serializer = new BlockObjectToBlockStateSerializer();
|
||||
}
|
||||
|
||||
public function testAllVanillaBlocksSerializableAndDeserializable() : void{
|
||||
foreach(VanillaBlocks::getAll() as $block){
|
||||
$blockStateData = $this->serializer->serializeBlock($block);
|
||||
$newBlock = $this->deserializer->deserializeBlock($blockStateData);
|
||||
|
||||
self::assertSame($block->getFullId(), $newBlock->getFullId());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user