Fixed dodgy custom block registration test

This commit is contained in:
Dylan K. Taylor 2023-04-13 12:27:55 +01:00
parent c3a2199f0e
commit 1c626baf1a
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -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()));
}
/**