Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Apr 9, 2024
1 parent eb1058a commit 1fdba79
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 31 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"php": ">=8.1"
},
"require-dev": {
"phpunit/phpunit": ">=10.0",
"phpunit/phpunit": "^10.0",
"nikic/php-fuzzer": "*",
"s9e/repdoc": "dev-wip"
},
Expand Down
5 changes: 2 additions & 3 deletions tests/BencodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 9 additions & 9 deletions tests/DecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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'))
Expand Down Expand Up @@ -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'))
Expand Down Expand Up @@ -417,6 +413,10 @@ public static function getDecodeInvalidTests()
'ld1',
new DecodingException('Premature end of data', 2)
],
[
'l-3:e',
new DecodingException('Illegal character', 1)
],
];
}

Expand Down
5 changes: 2 additions & 3 deletions tests/EncoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

use ArrayObject;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use TypeError;
use s9e\Bencode\BencodeSerializable;
use s9e\Bencode\Encoder;
use s9e\Bencode\Exceptions\EncodingException;
use stdClass;

/**
* @covers s9e\Bencode\Encoder
*/
#[CoversClass(Encoder::class)]
class EncoderTest extends TestCase
{
#[DataProvider('getEncodeTests')]
Expand Down
6 changes: 0 additions & 6 deletions tests/Exceptions/DecodingExceptionTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<?php declare(strict_types=1);

/**
* @package s9e\Bencode
* @copyright Copyright (c) The s9e authors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace s9e\Bencode\Tests\Exceptions;


use PHPUnit\Framework\TestCase;
use TypeError;
use s9e\Bencode\Exceptions\DecodingException;
Expand Down
5 changes: 0 additions & 5 deletions tests/Exceptions/EncodingExceptionTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php declare(strict_types=1);

/**
* @package s9e\Bencode
* @copyright Copyright (c) The s9e authors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace s9e\Bencode\Tests\Exceptions;

use PHPUnit\Framework\TestCase;
Expand Down
8 changes: 4 additions & 4 deletions tests/NonCompliantDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
namespace s9e\Bencode\Tests;

use ArrayObject;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use s9e\Bencode\Decoder;
use s9e\Bencode\Exceptions\DecodingException;
use s9e\Bencode\NonCompliantDecoder;

/**
* @covers s9e\Bencode\Decoder
* @covers s9e\Bencode\NonCompliantDecoder
*/
#[CoversClass(Decoder::class)]
#[CoversClass(NonCompliantDecoder::class)]
class NonCompliantDecoderTest extends TestCase
{
use NonCompliantTestProvider;
Expand Down

0 comments on commit 1fdba79

Please sign in to comment.