Merge 'minor-next' into 'major-next'

Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11652590245
This commit is contained in:
github-actions
2024-11-03 15:33:37 +00:00
17 changed files with 644 additions and 167 deletions

View File

@ -24,8 +24,10 @@ declare(strict_types=1);
namespace pocketmine\data\bedrock\block\upgrade;
use PHPUnit\Framework\TestCase;
use pocketmine\block\Block;
use pocketmine\data\bedrock\block\BlockStateData;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use const PHP_INT_MAX;
class BlockStateUpgraderTest extends TestCase{
@ -210,6 +212,23 @@ class BlockStateUpgraderTest extends TestCase{
self::assertSame($upgradedStateData->getState(self::TEST_PROPERTY_2)?->getValue(), $valueAfter);
}
public function testFlattenProperty() : void{
$schema = $this->getNewSchema();
$schema->flattenedProperties[self::TEST_BLOCK] = new BlockStateUpgradeSchemaFlattenInfo(
"minecraft:",
"test",
"_suffix",
[],
StringTag::class
);
$stateData = new BlockStateData(self::TEST_BLOCK, ["test" => new StringTag("value1")], 0);
$upgradedStateData = $this->upgrade($stateData, fn() => $stateData);
self::assertSame("minecraft:value1_suffix", $upgradedStateData->getName());
self::assertEmpty($upgradedStateData->getStates());
}
/**
* @phpstan-return \Generator<int, array{int, int, bool, int}, void, void>
*/