Skip to content

Commit

Permalink
Add support for PHPUnit 11
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Nov 2, 2024
1 parent 42c131a commit 18c73de
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^10.0",
"phpunit/phpunit": "^10.0 || ^11.0",
"phpstan/phpstan": "^1",
"squizlabs/php_codesniffer": "^3.8",
"slevomat/coding-standard": "~8.0"
Expand Down
23 changes: 19 additions & 4 deletions tests/Unit/AbstractDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,39 @@ final class AbstractDecoderTest extends BaseTestCase
public function testConstructor(): void
{
$handle = $this->getTestHandle('foobarbaz');
$decoder = $this->getMockForAbstractClass(AbstractDecoder::class, [$handle, 12]);
$decoder = $this->decoder($handle, 12);
$this->assertEquals(12, $decoder->getLength());
}

public function testSetHandle(): void
{
$handle = $this->getTestHandle('foobarbaz');
$decoder = $this->getMockForAbstractClass(AbstractDecoder::class, [$handle]);
$decoder = $this->decoder($handle);
$result = $decoder->setHandle($handle);
$this->assertInstanceOf(AbstractDecoder::class, $result);
}

public function testSetGetLength(): void
{
$handle = $this->getTestHandle('foobarbaz');
$decoder = $this->getMockForAbstractClass(AbstractDecoder::class, [$handle]);
$decoder = $this->decoder($this->getTestHandle('foobarbaz'));
$this->assertNull($decoder->getLength());
$decoder->setLength(1);
$this->assertEquals(1, $decoder->getLength());
}

private function decoder(mixed $handle, ?int $length = null): AbstractDecoder
{
return new class ($handle, $length) extends AbstractDecoder
{
/**
* Decode current source
*
* @return mixed
*/
public function decode(): mixed
{
return null;
}
};
}
}

0 comments on commit 18c73de

Please sign in to comment.