diff options
Diffstat (limited to 'tests/lib/MemoryInfoTest.php')
-rw-r--r-- | tests/lib/MemoryInfoTest.php | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/tests/lib/MemoryInfoTest.php b/tests/lib/MemoryInfoTest.php index 2477de2d799..13e46c96601 100644 --- a/tests/lib/MemoryInfoTest.php +++ b/tests/lib/MemoryInfoTest.php @@ -37,12 +37,7 @@ class MemoryInfoTest extends TestCase { ini_set('memory_limit', $this->iniSettingBeforeTest); } - /** - * Provides test data. - * - * @return array - */ - public function getMemoryLimitTestData(): array { + public static function getMemoryLimitTestData(): array { return [ 'unlimited' => ['-1', -1,], '524288000 bytes' => ['524288000', 524288000,], @@ -57,20 +52,15 @@ class MemoryInfoTest extends TestCase { * * @param string $iniValue The "memory_limit" ini data. * @param int|float $expected The expected detected memory limit. - * @dataProvider getMemoryLimitTestData */ + #[\PHPUnit\Framework\Attributes\DataProvider('getMemoryLimitTestData')] public function testMemoryLimit(string $iniValue, int|float $expected): void { ini_set('memory_limit', $iniValue); $memoryInfo = new MemoryInfo(); self::assertEquals($expected, $memoryInfo->getMemoryLimit()); } - /** - * Provides sufficient memory limit test data. - * - * @return array - */ - public function getSufficientMemoryTestData(): array { + public static function getSufficientMemoryTestData(): array { return [ 'unlimited' => [-1, true,], '512M' => [512 * 1024 * 1024, true,], @@ -84,13 +74,12 @@ class MemoryInfoTest extends TestCase { * * @param int $memoryLimit The memory limit * @param bool $expected If the memory limit is sufficient. - * @dataProvider getSufficientMemoryTestData - * @return void */ + #[\PHPUnit\Framework\Attributes\DataProvider('getSufficientMemoryTestData')] public function testIsMemoryLimitSufficient(int $memoryLimit, bool $expected): void { /* @var MemoryInfo|MockObject $memoryInfo */ $memoryInfo = $this->getMockBuilder(MemoryInfo::class) - ->setMethods(['getMemoryLimit',]) + ->onlyMethods(['getMemoryLimit',]) ->getMock(); $memoryInfo |