diff --git a/tests/phpunit/data/bedrock/block/upgrade/BlockStateUpgraderTest.php b/tests/phpunit/data/bedrock/block/upgrade/BlockStateUpgraderTest.php index efd22212fc..4d4d321ec0 100644 --- a/tests/phpunit/data/bedrock/block/upgrade/BlockStateUpgraderTest.php +++ b/tests/phpunit/data/bedrock/block/upgrade/BlockStateUpgraderTest.php @@ -47,11 +47,11 @@ class BlockStateUpgraderTest extends TestCase{ } private function getNewSchema() : BlockStateUpgradeSchema{ - return $this->getNewSchemaVersion(PHP_INT_MAX); + return $this->getNewSchemaVersion(PHP_INT_MAX, 0); } - private function getNewSchemaVersion(int $versionId) : BlockStateUpgradeSchema{ - $schema = new BlockStateUpgradeSchema(($versionId >> 24) & 0xff, ($versionId >> 16) & 0xff, ($versionId >> 8) & 0xff, $versionId & 0xff, 0); + private function getNewSchemaVersion(int $versionId, int $schemaId) : BlockStateUpgradeSchema{ + $schema = new BlockStateUpgradeSchema(($versionId >> 24) & 0xff, ($versionId >> 16) & 0xff, ($versionId >> 8) & 0xff, $versionId & 0xff, $schemaId); $this->upgrader->addSchema($schema); return $schema; } @@ -211,20 +211,23 @@ class BlockStateUpgraderTest extends TestCase{ } /** - * @phpstan-return \Generator + * @phpstan-return \Generator */ public static function upgraderVersionCompatibilityProvider() : \Generator{ - yield [0x1_00_00_00, 0x1_00_00_00, true]; //Same version: must be altered - this may be a backwards-compatible change that Mojang didn't bother to bump for - yield [0x1_00_01_00, 0x1_00_00_00, true]; //Schema newer than block: must be altered - yield [0x1_00_00_00, 0x1_00_01_00, false]; //Block newer than schema: block must NOT be altered + yield [0x1_00_00_00, 0x1_00_00_00, true, 2]; //Same version, multiple schemas targeting version - must be altered, we don't know which schemas are applicable + yield [0x1_00_00_00, 0x1_00_00_00, false, 1]; //Same version, one schema targeting version - do not change + yield [0x1_00_01_00, 0x1_00_00_00, true, 1]; //Schema newer than block: must be altered + yield [0x1_00_00_00, 0x1_00_01_00, false, 1]; //Block newer than schema: block must NOT be altered } /** * @dataProvider upgraderVersionCompatibilityProvider */ - public function testUpgraderVersionCompatibility(int $schemaVersion, int $stateVersion, bool $shouldChange) : void{ - $schema = $this->getNewSchemaVersion($schemaVersion); - $schema->renamedIds[self::TEST_BLOCK] = self::TEST_BLOCK_2; + public function testUpgraderVersionCompatibility(int $schemaVersion, int $stateVersion, bool $shouldChange, int $schemaCount) : void{ + for($i = 0; $i < $schemaCount; $i++){ + $schema = $this->getNewSchemaVersion($schemaVersion, $i); + $schema->renamedIds[self::TEST_BLOCK] = self::TEST_BLOCK_2; + } $getStateData = fn() => new BlockStateData( self::TEST_BLOCK,