Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: php
# lock distro so future defaults will not break the build
dist: trusty

matrix:
jobs:
include:
- php: 5.3
dist: precise
Expand All @@ -17,7 +17,7 @@ matrix:
- php: 7.4

install:
- composer install --no-interaction
- composer install

script:
- vendor/bin/phpunit --coverage-text
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require-dev": {
"clue/hexdump": "~0.2.0",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"phpunit/phpunit": "^7.0 || ^6.0 || ^5.0 || ^4.8.35"
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35"
},
"autoload": {
"psr-4": { "Clue\\React\\Tar\\": "src/" }
Expand Down
5 changes: 4 additions & 1 deletion tests/DecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class DecoderTest extends TestCase
{
private $decoder;

public function setUp()
/**
* @before
*/
public function setUpDecoder()
{
$this->decoder = new Decoder();
}
Expand Down
5 changes: 4 additions & 1 deletion tests/FunctionalDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class FunctionDecoderTest extends TestCase
{
private $decoder;

public function setUp()
/**
* @before
*/
public function setUpDecoderAndLoop()
{
$this->decoder = new Decoder();
$this->loop = Factory::create();
Expand Down
21 changes: 10 additions & 11 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,35 @@ class TestCase extends \PHPUnit\Framework\TestCase
protected function expectCallableOnce()
{
$mock = $this->createCallableMock();
$mock
->expects($this->once())
->method('__invoke');
$mock->expects($this->once())->method('__invoke');

return $mock;
}

protected function expectCallableOnceWith($value)
{
$mock = $this->createCallableMock();
$mock
->expects($this->once())
->method('__invoke')
->with($value);
$mock->expects($this->once())->method('__invoke')->with($value);

return $mock;
}

protected function expectCallableNever()
{
$mock = $this->createCallableMock();
$mock
->expects($this->never())
->method('__invoke');
$mock->expects($this->never())->method('__invoke');

return $mock;
}

protected function createCallableMock()
{
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
// PHPUnit 9+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
} else {
// legacy PHPUnit 4 - PHPUnit 8
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
}
}
}