diff --git a/composer.json b/composer.json index 1ec3b56..ac4cd85 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": ">=10.0", + "phpunit/phpunit": "^10.0", "nikic/php-fuzzer": "*", "s9e/repdoc": "dev-wip" }, diff --git a/tests/BencodeTest.php b/tests/BencodeTest.php index fd565fd..0ac3f5f 100644 --- a/tests/BencodeTest.php +++ b/tests/BencodeTest.php @@ -3,12 +3,11 @@ namespace s9e\Bencode\Tests; use ArrayObject; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use s9e\Bencode\Bencode; -/** -* @covers s9e\Bencode\Bencode -*/ +#[CoversClass(Bencode::class)] class BencodeTest extends TestCase { public function testDecode() diff --git a/tests/DecoderTest.php b/tests/DecoderTest.php index a27f8bb..8447aad 100644 --- a/tests/DecoderTest.php +++ b/tests/DecoderTest.php @@ -3,16 +3,16 @@ namespace s9e\Bencode\Tests; use ArrayObject; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use TypeError; use s9e\Bencode\Decoder; use s9e\Bencode\Exceptions\ComplianceError; use s9e\Bencode\Exceptions\DecodingException; -/** -* @covers s9e\Bencode\Decoder -*/ +#[CoversClass(Decoder::class)] class DecoderTest extends TestCase { use NonCompliantTestProvider; @@ -23,9 +23,7 @@ public static function setUpBeforeClass(): void Decoder::decode('i1e'); } - /** - * @group memory - */ + #[Group('memory')] public function testMemoryList() { if (is_callable('memory_reset_peak_usage')) @@ -59,9 +57,7 @@ public function testMemoryList() $this->assertLessThan(4096, $delta); } - /** - * @group memory - */ + #[Group('memory')] public function testMemoryString() { if (is_callable('memory_reset_peak_usage')) @@ -417,6 +413,10 @@ public static function getDecodeInvalidTests() 'ld1', new DecodingException('Premature end of data', 2) ], + [ + 'l-3:e', + new DecodingException('Illegal character', 1) + ], ]; } diff --git a/tests/EncoderTest.php b/tests/EncoderTest.php index a2c7e97..daf8bd5 100644 --- a/tests/EncoderTest.php +++ b/tests/EncoderTest.php @@ -4,6 +4,7 @@ use ArrayObject; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use TypeError; use s9e\Bencode\BencodeSerializable; @@ -11,9 +12,7 @@ use s9e\Bencode\Exceptions\EncodingException; use stdClass; -/** -* @covers s9e\Bencode\Encoder -*/ +#[CoversClass(Encoder::class)] class EncoderTest extends TestCase { #[DataProvider('getEncodeTests')] diff --git a/tests/Exceptions/DecodingExceptionTest.php b/tests/Exceptions/DecodingExceptionTest.php index 8f14769..6374f3c 100644 --- a/tests/Exceptions/DecodingExceptionTest.php +++ b/tests/Exceptions/DecodingExceptionTest.php @@ -1,13 +1,7 @@