From 45e7d06b002e0dde3dfb27b2484858b32caed7d3 Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 10 Feb 2025 23:45:44 +0100 Subject: Modernizing test suite to PHPUnit 11.x compatibility --- test/ApiTest.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'test/ApiTest.php') diff --git a/test/ApiTest.php b/test/ApiTest.php index 0a8290c..0786af0 100644 --- a/test/ApiTest.php +++ b/test/ApiTest.php @@ -1,8 +1,9 @@ _doTest($input, $expected); } - /** - * @dataProvider generatedDataProvider - */ + #[DataProvider('generatedDataProvider')] public function testBoardCounts($input, $expected) { $input['boards'] = strval($input['over39_boards'] ? rand(40, 60) : rand(1, 39)); unset($input['over39_boards']); $this->_doTest($input, $expected); } - /** - * @dataProvider bridgenetDataProvider - */ + #[DataProvider('bridgenetDataProvider')] public function testBridgenet($input, $expected) { $this->_doTest($input, $expected); } - private function _fileDataProvider($file) { + private static function _fileDataProvider($file) { $contents = file(dirname(__FILE__) . '/' . $file); $count = count($contents); for ($i = 0; $i < $count; $i += 2) { @@ -48,12 +43,12 @@ class ApiTest extends TestCase { } } - public function generatedDataProvider() { - yield from $this->_fileDataProvider('tests.txt'); + public static function generatedDataProvider() { + yield from self::_fileDataProvider('tests.txt'); } - public function bridgenetDataProvider() { - yield from $this->_fileDataProvider('bridgenet.txt'); + public static function bridgenetDataProvider() { + yield from self::_fileDataProvider('bridgenet.txt'); } } -- cgit v1.2.3