Skip to content

Commit

Permalink
Fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
artur-graniszewski committed Sep 26, 2018
1 parent 39598da commit 9498cda
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/Zeus/Kernel/Scheduler/Event/AbstractWorkerEvent.php
@@ -0,0 +1,16 @@
<?php

namespace Zeus\Kernel\Scheduler\Event;

use Zeus\Kernel\Scheduler\WorkerEvent;

abstract class AbstractWorkerEvent extends WorkerEvent
{
public function getName()
{
$name = parent::getName();

return $name ? $name : static::class;
}
}

2 changes: 1 addition & 1 deletion test/Kernel/Scheduler/PosixProcessTest.php
Expand Up @@ -227,7 +227,7 @@ public function testProcessTermination()
$this->assertEquals(1, $this->countMethodInExecutionLog($logArray, 'posixKill'), 'Kill signal should be sent');
$this->assertEquals(123456, $logArray[2][1][0], 'Kill signal should be sent to a certain process');
$this->assertEquals(SIGKILL, $logArray[2][1][1], 'Correct type of kill signal should be sent to a certain process');
$this->assertEquals(TerminateScheduler::class, $event->getName());
$this->assertEquals(TerminateWorker::class, $event->getName());
$pcntlMock->setExecutionLog([]);
}

Expand Down
6 changes: 5 additions & 1 deletion test/Kernel/Scheduler/ProcessOpenTest.php
Expand Up @@ -131,7 +131,11 @@ public function testProcessOpenFactory()
$event->getWorker()->setCode(WorkerState::EXITING);
}, WorkerEvent::PRIORITY_FINALIZE + 1);

$event = new InitializeWorker()
$worker = new WorkerState("test");
$event = new InitializeWorker();
$event->setScheduler($scheduler);
$event->setTarget($worker);
$event->setWorker($worker);
$event->setParam(SchedulerInterface::WORKER_INIT, true);
$event->setParam(SchedulerInterface::WORKER_SERVER, true);
$event->setParam(ModuleDecorator::ZEUS_IPC_ADDRESS_PARAM, "tcp://127.0.0.1:0");
Expand Down

0 comments on commit 9498cda

Please sign in to comment.