Skip to content

Commit

Permalink
Fix tests (#6)
Browse files Browse the repository at this point in the history
* fix travis

* fix travis

* fix travis

* fix travis

* fix travis + test

* update ProcessManager
  • Loading branch information
KallooaSan authored and jygaulier committed Apr 25, 2018
1 parent d1c3f2f commit be68ac4
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 11 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ cache:
- $HOME/.composer

php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'

matrix:
fast_finish: true
allow_failures:
- php: '7.0'
- php: '7.2'

before_script:
- phpenv config-rm xdebug.ini
- sudo apt-get install php-pear -y
- sudo apt-get install libzmq-dev -y
- yes '' | sudo pecl install zmq-beta
- echo "extension=zmq.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
- composer self-update
- composer install
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"php": "~7.0",
"ext-zmq": "*",

"neutron/process-manager": "2.0.x-dev@dev",
"neutron/process-manager": "~4.1",
"neutron/signal-handler": "~1.0",
"symfony/event-dispatcher": "~2.0",
"symfony/process": "~2.4"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/romainneutron/ProcessManager"
"url": "https://github.com/alchemy-fr/ProcessManager"
}
],
"require-dev": {
Expand Down
1 change: 1 addition & 0 deletions src/Alchemy/TaskManager/TaskManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public function start()
$this->dispatcher->dispatch(TaskManagerEvents::MANAGER_TICK, new TaskManagerEvent($this));
// sleep at list 10ms, at max 100ms
usleep(max($this->options['tick_period'] - (microtime(true) - $start), 0.01) * 1E6);
pcntl_signal_dispatch();
}

return $this;
Expand Down
3 changes: 2 additions & 1 deletion src/Alchemy/TaskManager/Test/TaskListTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Alchemy\TaskManager\Test;

use Alchemy\TaskManager\TaskListInterface;
use \PHPUnit\Framework\TestCase;

abstract class TaskListTestCase extends \PHPUnit_Framework_TestCase
abstract class TaskListTestCase extends TestCase
{
public function testThatRefreshReturnsAnArrayOfTaskInterface()
{
Expand Down
3 changes: 2 additions & 1 deletion src/Alchemy/TaskManager/Test/TaskTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Alchemy\TaskManager\Test;

use Alchemy\TaskManager\TaskInterface;
use \PHPUnit\Framework\TestCase;

abstract class TaskTestCase extends \PHPUnit\Framework\TestCase
abstract class TaskTestCase extends TestCase
{
public function testThatCreateProcessReturnsAProcessableInterface()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Alchemy/Functional/TaskManager/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Alchemy\Functional\TaskManager;

use Symfony\Component\Finder\Finder;
use \PHPUnit\Framework\TestCase;

class FunctionalTestCase extends \PHPUnit_Framework_TestCase
class FunctionalTestCase extends TestCase
{
protected $lockDir;

Expand Down
2 changes: 2 additions & 0 deletions tests/Alchemy/Test/TaskManager/Event/StateFormaterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function provideProcessesAndStates()

$managed1 = $this->getMockBuilder('Neutron\ProcessManager\ManagedProcess')
->disableOriginalConstructor()
->disableOriginalClone()
->getMock();
$managed1->expects($this->any())
->method('getManagedProcess')
Expand All @@ -42,6 +43,7 @@ public function provideProcessesAndStates()

$managed2 = $this->getMockBuilder('Neutron\ProcessManager\ManagedProcess')
->disableOriginalConstructor()
->disableOriginalClone()
->getMock();
$managed2->expects($this->any())
->method('getManagedProcess')
Expand Down
1 change: 0 additions & 1 deletion tests/Alchemy/Test/TaskManager/TaskManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public function testThatItRunsWithoutAnyProcesses()
->method('refresh')
->will($this->returnValue(array()));
$manager = TaskManager::create(new EventDispatcher(), $this->createLoggerMock(), $taskList);
declare(ticks=1);
pcntl_alarm(1);
pcntl_signal(SIGALRM, function () use ($manager) { $manager->stop(); });
$start = microtime(true);
Expand Down

0 comments on commit be68ac4

Please sign in to comment.