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
23 changes: 8 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
language: php

php:
# - 5.3 # requires old distro
# - 5.4 # requires old distro
# - 5.5 # requires old distro
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

# lock distro so new future defaults will not break the build
dist: xenial

matrix:
jobs:
include:
- php: 5.3
dist: precise
- php: 5.4
dist: trusty
- php: 5.5
dist: trusty

sudo: false
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
- 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 @@ -23,7 +23,7 @@
"require-dev": {
"clue/block-react": "^1.0",
"clue/buzz-react": "^2.4",
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35",
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3"
}
}
12 changes: 3 additions & 9 deletions tests/QueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,21 @@ public function testCtorWithNoHardLimit()
$q = new Queue(1, null, function () { });
}

/**
* @expectedException InvalidArgumentException
*/
public function testCtorThrowsIfNotCallable()
{
$this->setExpectedException('InvalidArgumentException');
new Queue(1, 2, null);
}

/**
* @expectedException InvalidArgumentException
*/
public function testCtorThrowsIfConcurrencyTooLow()
{
$this->setExpectedException('InvalidArgumentException');
new Queue(0, 2, function () { });
}

/**
* @expectedException InvalidArgumentException
*/
public function testCtorThrowsIfConcurrencyAboveLiit()
{
$this->setExpectedException('InvalidArgumentException');
new Queue(3, 2, function () { });
}

Expand Down
25 changes: 24 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@ protected function expectCallableNever()

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

public function setExpectedException($exception, $exceptionMessage = '', $exceptionCode = null)
{
if (method_exists($this, 'expectException')) {
// PHPUnit 5.2+
$this->expectException($exception);
if ($exceptionMessage !== '') {
$this->expectExceptionMessage($exceptionMessage);
}
if ($exceptionCode !== null) {
$this->expectExceptionCode($exceptionCode);
}
} else {
// legacy PHPUnit 4 - PHPUnit 5.1
parent::setExpectedException($exception, $exceptionMessage, $exceptionCode);
}
}
}