From 1c626baf1a2f1086b63bf3d7293dfa415c6d7ab9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 13 Apr 2023 12:27:55 +0100 Subject: [PATCH] Fixed dodgy custom block registration test --- tests/phpunit/block/BlockTest.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/block/BlockTest.php b/tests/phpunit/block/BlockTest.php index 8712212c5..cf0b674d6 100644 --- a/tests/phpunit/block/BlockTest.php +++ b/tests/phpunit/block/BlockTest.php @@ -62,16 +62,9 @@ class BlockTest extends TestCase{ * Test registering a new block which does not yet exist */ public function testRegisterNewBlock() : void{ - for($i = BlockTypeIds::FIRST_UNUSED_BLOCK_ID; $i < BlockTypeIds::FIRST_UNUSED_BLOCK_ID + 256; ++$i){ - if(!$this->blockFactory->isRegistered($i)){ - $b = new StrangeNewBlock(new BlockIdentifier($i), "Strange New Block", new BlockTypeInfo(BlockBreakInfo::instant())); - $this->blockFactory->register($b); - self::assertInstanceOf(StrangeNewBlock::class, $this->blockFactory->fromStateId($b->getStateId())); - return; - } - } - - throw new \RuntimeException("Can't test registering new blocks because no unused spaces left"); + $b = new StrangeNewBlock(new BlockIdentifier(BlockTypeIds::newId()), "Strange New Block", new BlockTypeInfo(BlockBreakInfo::instant())); + $this->blockFactory->register($b); + self::assertInstanceOf(StrangeNewBlock::class, $this->blockFactory->fromStateId($b->getStateId())); } /**