diff --git a/composer.json b/composer.json index b68cf35c0..fa911af06 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "require-dev": { "chillerlan/php-authenticator": "^5.0", "phan/phan": "^5.4", - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^10.4", "phpmd/phpmd": "^2.14", "setasign/fpdf": "^1.8.2", "squizlabs/php_codesniffer": "^3.7" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0c5866732..a6ecbeeb9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,21 +1,22 @@ - ./tests/ + ./tests/ ./tests/Performance - + - ./src + src + + diff --git a/tests/Common/BitBufferTest.php b/tests/Common/BitBufferTest.php index b03f73424..0b720040b 100644 --- a/tests/Common/BitBufferTest.php +++ b/tests/Common/BitBufferTest.php @@ -12,6 +12,7 @@ namespace chillerlan\QRCodeTest\Common; use chillerlan\QRCode\Common\{BitBuffer, Mode}; use chillerlan\QRCode\QRCodeException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -34,9 +35,7 @@ final class BitBufferTest extends TestCase{ ]; } - /** - * @dataProvider bitProvider - */ + #[DataProvider('bitProvider')] public function testPut(int $data, int $value):void{ $this->bitBuffer->put($data, 4); $this::assertSame($value, $this->bitBuffer->getBuffer()[0]); diff --git a/tests/Common/ECICharsetTest.php b/tests/Common/ECICharsetTest.php index 56cb027bb..d936c183b 100644 --- a/tests/Common/ECICharsetTest.php +++ b/tests/Common/ECICharsetTest.php @@ -12,6 +12,7 @@ namespace chillerlan\QRCodeTest\Common; use chillerlan\QRCode\Common\ECICharset; use chillerlan\QRCode\QRCodeException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class ECICharsetTest extends TestCase{ @@ -20,9 +21,7 @@ final class ECICharsetTest extends TestCase{ return [[-1], [1000000]]; } - /** - * @dataProvider invalidIdProvider - */ + #[DataProvider('invalidIdProvider')] public function testInvalidDataException(int $id):void{ $this->expectException(QRCodeException::class); $this->expectExceptionMessage('invalid charset id:'); @@ -30,7 +29,7 @@ final class ECICharsetTest extends TestCase{ new ECICharset($id); } - public function encodingProvider():array{ + public static function encodingProvider():array{ $params = []; foreach(ECICharset::MB_ENCODINGS as $id => $name){ @@ -40,9 +39,7 @@ final class ECICharsetTest extends TestCase{ return $params; } - /** - * @dataProvider encodingProvider - */ + #[DataProvider('encodingProvider')] public function testGetName(int $id, string $name = null):void{ $eciCharset = new ECICharset($id); diff --git a/tests/Common/MaskPatternTest.php b/tests/Common/MaskPatternTest.php index f64d1be92..ba3363155 100644 --- a/tests/Common/MaskPatternTest.php +++ b/tests/Common/MaskPatternTest.php @@ -16,6 +16,7 @@ namespace chillerlan\QRCodeTest\Common; use chillerlan\QRCode\Common\MaskPattern; use chillerlan\QRCode\QRCodeException; use Closure; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -95,9 +96,8 @@ final class MaskPatternTest extends TestCase{ /** * Tests if the mask function generates the correct pattern - * - * @dataProvider maskPatternProvider */ + #[DataProvider('maskPatternProvider')] public function testMask(int $pattern, array $expected):void{ $maskPattern = new MaskPattern($pattern); diff --git a/tests/Common/ModeTest.php b/tests/Common/ModeTest.php index bd729129f..c478d72de 100644 --- a/tests/Common/ModeTest.php +++ b/tests/Common/ModeTest.php @@ -12,6 +12,7 @@ namespace chillerlan\QRCodeTest\Common; use chillerlan\QRCode\Common\Mode; use chillerlan\QRCode\QRCodeException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -33,9 +34,7 @@ final class ModeTest extends TestCase{ ]; } - /** - * @dataProvider versionProvider - */ + #[DataProvider('versionProvider')] public function testGetLengthBitsForVersionBreakpoints(int $version, int $expected):void{ $this::assertSame($expected, Mode::getLengthBitsForVersion(Mode::NUMBER, $version)); } diff --git a/tests/Data/ByteTest.php b/tests/Data/ByteTest.php index 6594bc019..190288697 100644 --- a/tests/Data/ByteTest.php +++ b/tests/Data/ByteTest.php @@ -36,7 +36,6 @@ final class ByteTest extends DataInterfaceTestAbstract{ * @inheritDoc */ public function testInvalidDataException():void{ - /** @noinspection PhpUnitTestFailedLineInspection */ $this::markTestSkipped('N/A (binary mode)'); } @@ -44,7 +43,6 @@ final class ByteTest extends DataInterfaceTestAbstract{ * @inheritDoc */ public function testBinaryStringInvalid():void{ - /** @noinspection PhpUnitTestFailedLineInspection */ $this::markTestSkipped('N/A (binary mode)'); } diff --git a/tests/Data/DataInterfaceTestAbstract.php b/tests/Data/DataInterfaceTestAbstract.php index 1998c229e..7ce491bdf 100644 --- a/tests/Data/DataInterfaceTestAbstract.php +++ b/tests/Data/DataInterfaceTestAbstract.php @@ -11,6 +11,7 @@ namespace chillerlan\QRCodeTest\Data; use chillerlan\QRCode\Common\{EccLevel, MaskPattern, Mode, Version}; +use PHPUnit\Framework\Attributes\DataProvider; use chillerlan\QRCode\Data\{QRCodeDataException, QRData, QRDataModeInterface, QRMatrix}; use chillerlan\QRCode\QROptions; use chillerlan\QRCodeTest\QRMaxLengthTrait; @@ -64,9 +65,8 @@ abstract class DataInterfaceTestAbstract extends TestCase{ /** * Tests initializing the data matrix - * - * @dataProvider maskPatternProvider */ + #[DataProvider('maskPatternProvider')] public function testInitMatrix(int $pattern):void{ $maskPattern = new MaskPattern($pattern); @@ -82,9 +82,8 @@ abstract class DataInterfaceTestAbstract extends TestCase{ /** * Tests if a string is properly validated for the respective data mode - * - * @dataProvider stringValidateProvider */ + #[DataProvider('stringValidateProvider')] public function testValidateString(string $string, bool $expected):void{ /** @noinspection PhpUndefinedMethodInspection */ $this::assertSame($expected, static::$FQN::validateString($string)); @@ -109,9 +108,8 @@ abstract class DataInterfaceTestAbstract extends TestCase{ /** * Tests decoding a data segment from a given BitBuffer - * - * @dataProvider versionBreakpointProvider */ + #[DataProvider('versionBreakpointProvider')] public function testDecodeSegment(int $version):void{ $options = new QROptions; $options->version = $version; @@ -168,9 +166,7 @@ abstract class DataInterfaceTestAbstract extends TestCase{ } - /** - * @dataProvider maxLengthProvider - */ + #[DataProvider('maxLengthProvider')] public function testMaxLength(Version $version, EccLevel $eccLevel, string $str):void{ $options = new QROptions; $options->version = $version->getVersionNumber(); @@ -185,9 +181,8 @@ abstract class DataInterfaceTestAbstract extends TestCase{ /** * Tests getting the minimum QR version for the given data - * - * @dataProvider maxLengthProvider */ + #[DataProvider('maxLengthProvider')] public function testGetMinimumVersion(Version $version, EccLevel $eccLevel, string $str):void{ $options = new QROptions; $options->version = Version::AUTO; @@ -208,9 +203,8 @@ abstract class DataInterfaceTestAbstract extends TestCase{ /** * Tests if an exception is thrown on data overflow - * - * @dataProvider maxLengthProvider */ + #[DataProvider('maxLengthProvider')] public function testMaxLengthOverflowException(Version $version, EccLevel $eccLevel, string $str, string $str1):void{ $this->expectException(QRCodeDataException::class); $this->expectExceptionMessage('code length overflow'); diff --git a/tests/Data/ECITest.php b/tests/Data/ECITest.php index 964f0b87e..f6e8293ca 100644 --- a/tests/Data/ECITest.php +++ b/tests/Data/ECITest.php @@ -13,6 +13,7 @@ namespace chillerlan\QRCodeTest\Data; use chillerlan\QRCode\QROptions; use chillerlan\QRCode\Common\{BitBuffer, ECICharset, Mode}; use chillerlan\QRCode\Data\{Byte, ECI, Number, QRCodeDataException, QRData, QRDataModeInterface}; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -51,8 +52,8 @@ final class ECITest extends TestCase{ /** * @inheritDoc - * @dataProvider versionBreakpointProvider */ + #[DataProvider('versionBreakpointProvider')] public function testDecodeSegment(int $version):void{ $options = new QROptions; $options->version = $version; @@ -102,9 +103,7 @@ final class ECITest extends TestCase{ ]; } - /** - * @dataProvider eciCharsetIdProvider - */ + #[DataProvider('eciCharsetIdProvider')] public function testReadWrite(int $id, int $lengthInBits):void{ $bitBuffer = new BitBuffer; $eci = (new ECI($id))->write($bitBuffer, 1); @@ -133,7 +132,7 @@ final class ECITest extends TestCase{ ECI::decodeSegment($bitBuffer, $options->version); } - public function unknownEncodingDataProvider():array{ + public static function unknownEncodingDataProvider():array{ return [ 'CP437' => [0, "\x41\x42\x43"], 'ISO_IEC_8859_1_GLI' => [1, "\x41\x42\x43"], @@ -142,9 +141,8 @@ final class ECITest extends TestCase{ /** * Tests detection of an unknown character set - * - * @dataProvider unknownEncodingDataProvider */ + #[DataProvider('unknownEncodingDataProvider')] public function testConvertUnknownEncoding(int $id, string $data):void{ $options = new QROptions; $options->version = 5; diff --git a/tests/Data/HanziTest.php b/tests/Data/HanziTest.php index 9b03c17dd..2a03a1bb2 100644 --- a/tests/Data/HanziTest.php +++ b/tests/Data/HanziTest.php @@ -12,6 +12,8 @@ namespace chillerlan\QRCodeTest\Data; use chillerlan\QRCode\Data\Hanzi; use Generator, Throwable; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use function bin2hex, chr, defined, sprintf; /** @@ -57,10 +59,8 @@ final class HanziTest extends DataInterfaceTestAbstract{ } - /** - * @group slow - * @dataProvider hanziProvider - */ + #[Group('slow')] + #[DataProvider('hanziProvider')] public function testValidateGB2312(string $chr):void{ // we may run into several issues due to encoding detection failures try{ diff --git a/tests/Data/KanjiTest.php b/tests/Data/KanjiTest.php index 57b363ce0..9c0cb5c7a 100644 --- a/tests/Data/KanjiTest.php +++ b/tests/Data/KanjiTest.php @@ -12,6 +12,8 @@ namespace chillerlan\QRCodeTest\Data; use chillerlan\QRCode\Data\Kanji; use Generator, Throwable; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use function bin2hex, chr, defined, sprintf; /** @@ -76,10 +78,8 @@ final class KanjiTest extends DataInterfaceTestAbstract{ } - /** - * @group slow - * @dataProvider kanjiProvider - */ + #[Group('slow')] + #[DataProvider('kanjiProvider')] public function testValidateSJIS(string $chr):void{ // we may run into several issues due to encoding detection failures try{ diff --git a/tests/Data/QRMatrixTest.php b/tests/Data/QRMatrixTest.php index 14bd72ff7..26915f7fd 100755 --- a/tests/Data/QRMatrixTest.php +++ b/tests/Data/QRMatrixTest.php @@ -10,6 +10,7 @@ namespace chillerlan\QRCodeTest\Data; +use PHPUnit\Framework\Attributes\DataProvider; use chillerlan\QRCode\{QRCode, QROptions}; use chillerlan\QRCode\Common\{EccLevel, MaskPattern, Version}; use chillerlan\QRCode\Data\{QRCodeDataException, QRMatrix}; @@ -176,9 +177,8 @@ final class QRMatrixTest extends TestCase{ /** * Tests setting the dark module and verifies its position - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testSetDarkModule(QRMatrix $matrix):void{ $matrix->setDarkModule(); @@ -189,9 +189,8 @@ final class QRMatrixTest extends TestCase{ /** * Tests setting the finder patterns and verifies their positions - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testSetFinderPattern(QRMatrix $matrix):void{ $matrix->setFinderPattern(); @@ -204,9 +203,8 @@ final class QRMatrixTest extends TestCase{ /** * Tests the separator patterns and verifies their positions - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testSetSeparators(QRMatrix $matrix):void{ $matrix->setSeparators(); @@ -220,14 +218,12 @@ final class QRMatrixTest extends TestCase{ /** * Tests the alignment patterns and verifies their positions - version 1 (no pattern) skipped - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testSetAlignmentPattern(QRMatrix $matrix):void{ $version = $matrix->getVersion(); if($version->getVersionNumber() === 1){ - /** @noinspection PhpUnitTestFailedLineInspection */ $this::markTestSkipped('N/A (Version 1 has no alignment pattern)'); } @@ -253,9 +249,8 @@ final class QRMatrixTest extends TestCase{ /** * Tests the timing patterns and verifies their positions - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testSetTimingPattern(QRMatrix $matrix):void{ $matrix @@ -282,13 +277,11 @@ final class QRMatrixTest extends TestCase{ /** * Tests the version patterns and verifies their positions - version < 7 skipped - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testSetVersionNumber(QRMatrix $matrix):void{ if($matrix->getVersion()->getVersionNumber() < 7){ - /** @noinspection PhpUnitTestFailedLineInspection */ $this::markTestSkipped('N/A (Version < 7)'); } @@ -304,9 +297,8 @@ final class QRMatrixTest extends TestCase{ /** * Tests the format patterns and verifies their positions - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testSetFormatInfo(QRMatrix $matrix):void{ $matrix->setFormatInfo(new MaskPattern(MaskPattern::PATTERN_000)); @@ -320,9 +312,8 @@ final class QRMatrixTest extends TestCase{ /** * Tests the quiet zone pattern and verifies its position - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testSetQuietZone(QRMatrix $matrix):void{ $size = $matrix->getSize(); $quietZoneSize = 5; @@ -362,9 +353,8 @@ final class QRMatrixTest extends TestCase{ /** * Tests rotating the matrix by 90 degrees CW - * - * @dataProvider matrixProvider */ + #[DataProvider('matrixProvider')] public function testRotate90(QRMatrix $matrix):void{ $matrix->initFunctionalPatterns(); diff --git a/tests/Output/QRGdImageTestAbstract.php b/tests/Output/QRGdImageTestAbstract.php index f24db6c9f..e5972a81d 100644 --- a/tests/Output/QRGdImageTestAbstract.php +++ b/tests/Output/QRGdImageTestAbstract.php @@ -6,12 +6,14 @@ * @author Smiley * @copyright 2017 Smiley * @license MIT + * + * @noinspection PhpComposerExtensionStubsInspection */ namespace chillerlan\QRCodeTest\Output; use chillerlan\QRCode\Data\QRMatrix; -use const PHP_MAJOR_VERSION; +use GdImage; /** * Tests the QRGdImage output module @@ -58,19 +60,11 @@ abstract class QRGdImageTestAbstract extends QROutputTestAbstract{ $this::assertTrue(true); // tricking the code coverage } - /** - * @todo: remove php version check in v6 - */ public function testOutputGetResource():void{ $this->options->returnResource = true; $this->outputInterface = new $this->FQN($this->options, $this->matrix); - $actual = $this->outputInterface->dump(); - - /** @noinspection PhpFullyQualifiedNameUsageInspection */ - PHP_MAJOR_VERSION >= 8 - ? $this::assertInstanceOf(\GdImage::class, $actual) - : $this::assertIsResource($actual); + $this::assertInstanceOf(GdImage::class, $this->outputInterface->dump()); } public function testBase64MimeType():void{ diff --git a/tests/Output/QRImagickTest.php b/tests/Output/QRImagickTest.php index 35d15cd1f..91779182d 100644 --- a/tests/Output/QRImagickTest.php +++ b/tests/Output/QRImagickTest.php @@ -7,7 +7,6 @@ * @copyright 2018 smiley * @license MIT * - * @noinspection PhpUndefinedClassInspection * @noinspection PhpComposerExtensionStubsInspection */ diff --git a/tests/Output/QROutputTestAbstract.php b/tests/Output/QROutputTestAbstract.php index 454096064..6f47bd4c0 100644 --- a/tests/Output/QROutputTestAbstract.php +++ b/tests/Output/QROutputTestAbstract.php @@ -13,6 +13,8 @@ namespace chillerlan\QRCodeTest\Output; use chillerlan\QRCode\QRCode; use chillerlan\QRCode\QROptions; use chillerlan\QRCode\Data\QRMatrix; +use chillerlan\Settings\SettingsContainerInterface; +use PHPUnit\Framework\Attributes\DataProvider; use chillerlan\QRCode\Output\{QRCodeOutputException, QROutputInterface}; use PHPUnit\Framework\TestCase; @@ -25,12 +27,11 @@ use function str_replace; */ abstract class QROutputTestAbstract extends TestCase{ - /** @var \chillerlan\QRCode\QROptions|\chillerlan\Settings\SettingsContainerInterface */ - protected QROptions $options; - protected QROutputInterface $outputInterface; - protected QRMatrix $matrix; - protected string $builddir = __DIR__.'/../../.build/output_test'; - protected string $FQN; + protected SettingsContainerInterface|QROptions $options; + protected QROutputInterface $outputInterface; + protected QRMatrix $matrix; + protected string $builddir = __DIR__.'/../../.build/output-test'; + protected string $FQN; /** * Attempts to create a directory under /.build and instances several required objects @@ -41,10 +42,10 @@ abstract class QROutputTestAbstract extends TestCase{ mkdir($this->builddir, 0777, true); } - $this->options = new QROptions; + $this->options = new QROptions; $this->options->outputInterface = $this->FQN; - $this->matrix = (new QRCode($this->options))->addByteSegment('testdata')->getQRMatrix(); - $this->outputInterface = new $this->FQN($this->options, $this->matrix); + $this->matrix = (new QRCode($this->options))->addByteSegment('testdata')->getQRMatrix(); + $this->outputInterface = new $this->FQN($this->options, $this->matrix); } /** @@ -67,13 +68,8 @@ abstract class QROutputTestAbstract extends TestCase{ abstract public static function moduleValueProvider():array; - /** - * @param mixed $value - * @param bool $expected - * - * @dataProvider moduleValueProvider - */ - public function testValidateModuleValues($value, bool $expected):void{ + #[DataProvider('moduleValueProvider')] + public function testValidateModuleValues(mixed $value, bool $expected):void{ /** @noinspection PhpUndefinedMethodInspection */ $this::assertSame($expected, $this->FQN::moduleValueIsValid($value)); } diff --git a/tests/Output/QRStringJSONTest.php b/tests/Output/QRStringJSONTest.php index 507ccdbd8..c003b2a60 100644 --- a/tests/Output/QRStringJSONTest.php +++ b/tests/Output/QRStringJSONTest.php @@ -11,6 +11,7 @@ namespace chillerlan\QRCodeTest\Output; use chillerlan\QRCode\Output\QRStringJSON; +use PHPUnit\Framework\Attributes\DataProvider; use function extension_loaded; /** @@ -33,11 +34,15 @@ final class QRStringJSONTest extends QROutputTestAbstract{ } public static function moduleValueProvider():array{ - return []; + return [[null, false]]; + } + + #[DataProvider('moduleValueProvider')] + public function testValidateModuleValues(mixed $value, bool $expected):void{ + $this::markTestSkipped('N/A (JSON test)'); } public function testSetModuleValues():void{ - /** @noinspection PhpUnitTestFailedLineInspection */ $this::markTestSkipped('N/A (JSON test)'); } diff --git a/tests/QRCodeReaderImagickTest.php b/tests/QRCodeReaderImagickTest.php index b52092383..6db408219 100644 --- a/tests/QRCodeReaderImagickTest.php +++ b/tests/QRCodeReaderImagickTest.php @@ -12,6 +12,7 @@ namespace chillerlan\QRCodeTest; use chillerlan\QRCode\Common\IMagickLuminanceSource; use chillerlan\QRCode\QRCode; +use PHPUnit\Framework\Attributes\DataProvider; use function extension_loaded; use const PHP_OS_FAMILY, PHP_VERSION_ID; @@ -43,9 +44,7 @@ final class QRCodeReaderImagickTest extends QRCodeReaderTestAbstract{ ]; } - /** - * @dataProvider vectorQRCodeProvider - */ + #[DataProvider('vectorQRCodeProvider')] public function testReadVectorFormats(string $img, string $expected):void{ if(PHP_OS_FAMILY === 'Linux'){ diff --git a/tests/QRCodeReaderTestAbstract.php b/tests/QRCodeReaderTestAbstract.php index 22192dffa..9389c388d 100644 --- a/tests/QRCodeReaderTestAbstract.php +++ b/tests/QRCodeReaderTestAbstract.php @@ -13,6 +13,8 @@ namespace chillerlan\QRCodeTest; use chillerlan\QRCodeTest\Data\QRMatrixTest; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use chillerlan\QRCode\{QRCode, QROptions}; use chillerlan\QRCode\Common\{EccLevel, Mode, Version}; use chillerlan\QRCode\Output\QRGdImagePNG; @@ -76,10 +78,8 @@ abstract class QRCodeReaderTestAbstract extends TestCase{ ]; } - /** - * @group slow - * @dataProvider qrCodeProvider - */ + #[Group('slow')] + #[DataProvider('qrCodeProvider')] public function testReader(string $img, string $expected, bool $grayscale):void{ if($grayscale){ @@ -140,10 +140,8 @@ abstract class QRCodeReaderTestAbstract extends TestCase{ } - /** - * @group slow - * @dataProvider dataTestProvider - */ + #[Group('slow')] + #[DataProvider('dataTestProvider')] public function testReadData(Version $version, EccLevel $ecc, string $expected):void{ $this->options->outputInterface = QRGdImagePNG::class; $this->options->imageTransparent = false; diff --git a/tests/QRCodeTest.php b/tests/QRCodeTest.php index ff5cf262d..9c89d0594 100755 --- a/tests/QRCodeTest.php +++ b/tests/QRCodeTest.php @@ -23,7 +23,7 @@ final class QRCodeTest extends TestCase{ private QRCode $qrcode; private QROptions $options; - private string $builddir = __DIR__.'/../.build/output_test'; + private string $builddir = __DIR__.'/../.build/output-test'; /** * invoke test instances diff --git a/tests/QROptionsTest.php b/tests/QROptionsTest.php index ccab4cbba..a871d9c96 100644 --- a/tests/QROptionsTest.php +++ b/tests/QROptionsTest.php @@ -16,6 +16,7 @@ use chillerlan\QRCode\Common\EccLevel; use chillerlan\QRCode\QRCodeException; use chillerlan\QRCode\QROptions; use chillerlan\QRCode\Common\Version; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -37,9 +38,8 @@ final class QROptionsTest extends TestCase{ /** * Tests the $version clamping - * - * @dataProvider VersionProvider */ + #[DataProvider('VersionProvider')] public function testVersionClamp(int $version, int $expected):void{ $o = new QROptions(['version' => $version]); @@ -60,9 +60,8 @@ final class QROptionsTest extends TestCase{ /** * Tests the $versionMin/$versionMax clamping - * - * @dataProvider VersionMinMaxProvider */ + #[DataProvider('VersionMinMaxProvider')] public function testVersionMinMaxClamp(int $versionMin, int $versionMax, int $expectedMin, int $expectedMax):void{ $o = new QROptions(['versionMin' => $versionMin, 'versionMax' => $versionMax]); @@ -129,9 +128,8 @@ final class QROptionsTest extends TestCase{ /** * Tests the clamping (between 0 and 177) of the logo space values - * - * @dataProvider logoSpaceValueProvider */ + #[DataProvider('logoSpaceValueProvider')] public function testClampLogoSpaceValue(int $value, int $expected):void{ $o = new QROptions; @@ -174,9 +172,8 @@ final class QROptionsTest extends TestCase{ /** * Tests clamping of the circle radius - * - * @dataProvider circleRadiusProvider */ + #[DataProvider('circleRadiusProvider')] public function testClampCircleRadius(float $value, float $expected):void{ $o = new QROptions(['circleRadius' => $value]);