Fixed botched unit tests

This commit is contained in:
Dylan K. Taylor 2022-07-06 23:28:08 +01:00
parent 8886a023f1
commit b0c76f4db5
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 14 additions and 1 deletions

View File

@ -110,7 +110,16 @@ class BlockTest extends TestCase{
if(!is_array($list)){
throw new \pocketmine\utils\AssumptionFailedError("Old table should be array{knownStates: array<string, string>, stateDataBits: int}");
}
$knownStates = $list["knownStates"];
$knownStates = [];
/**
* @var string $name
* @var int[] $stateIds
*/
foreach($list["knownStates"] as $name => $stateIds){
foreach($stateIds as $stateId){
$knownStates[$stateId] = $name;
}
}
$oldStateDataSize = $list["stateDataBits"];
self::assertSame($oldStateDataSize, Block::INTERNAL_STATE_DATA_BITS, "Changed number of state data bits - consistency check probably need regenerating");

View File

@ -46,6 +46,10 @@ if(file_exists($oldTablePath)){
throw new \pocketmine\utils\AssumptionFailedError("Old table should be array{knownStates: array<string, string>, stateDataBits: int}");
}
$old = [];
/**
* @var string $name
* @var int[] $stateIds
*/
foreach($oldTable["knownStates"] as $name => $stateIds){
foreach($stateIds as $stateId){
$old[$stateId] = $name;