PHPUnit migrated to attributes :(

This commit is contained in:
Dylan K. Taylor
2025-06-08 19:19:17 +01:00
parent 6b5ff5016e
commit 9e773ed439
14 changed files with 43 additions and 58 deletions

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\world\format\io\region;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use pocketmine\world\format\ChunkException;
use Symfony\Component\Filesystem\Path;
@ -82,11 +83,10 @@ class RegionLoaderTest extends TestCase{
}
/**
* @dataProvider outOfBoundsCoordsProvider
*
* @throws ChunkException
* @throws \InvalidArgumentException
*/
#[DataProvider("outOfBoundsCoordsProvider")]
public function testWriteChunkOutOfBounds(int $x, int $z) : void{
$this->expectException(\InvalidArgumentException::class);
$this->region->writeChunk($x, $z, str_repeat("\x00", 1000));
@ -107,11 +107,10 @@ class RegionLoaderTest extends TestCase{
}
/**
* @dataProvider outOfBoundsCoordsProvider
*
* @throws \InvalidArgumentException
* @throws \pocketmine\world\format\io\exception\CorruptedChunkException
*/
#[DataProvider("outOfBoundsCoordsProvider")]
public function testReadChunkOutOfBounds(int $x, int $z) : void{
$this->expectException(\InvalidArgumentException::class);
$this->region->readChunk($x, $z);

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\world\format\io\region;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use function sprintf;
@ -40,9 +41,7 @@ class RegionLocationTableEntryTest extends TestCase{
yield [new RegionLocationTableEntry(2, 4, 0), new RegionLocationTableEntry(3, 1, 0), true];
}
/**
* @dataProvider overlapDataProvider
*/
#[DataProvider("overlapDataProvider")]
public function testOverlap(RegionLocationTableEntry $entry1, RegionLocationTableEntry $entry2, bool $overlaps) : void{
$stringify = function(RegionLocationTableEntry $entry) : string{
return sprintf("entry first=%d last=%d size=%d", $entry->getFirstSector(), $entry->getLastSector(), $entry->getSectorCount());