public function processCall(Call $call)
{
if ($call->getRegistration() !== null) {
throw new \Exception("Registration already set when asked to process call");
}
$call->setRegistration($this);
$this->calls[] = $call;
$this->session->incPendingCallCount();
$callCount = count($this->calls);
if ($callCount == 1) {
// we just became busy
$this->busyStart = microtime(true);
}
if ($callCount > $this->maxSimultaneousCalls) {
$this->maxSimultaneousCalls = $callCount;
}
$this->invocationCount++;
$this->lastCallStartedAt = new \DateTime();
$this->getSession()->sendMessage($call->getInvocationMessage());
}
public function testMakingCallIncrementsCallCount() { $mockSession = $this->getMockBuilder('\\Thruway\\Session')->setConstructorArgs([new \Thruway\Transport\DummyTransport()])->getMock(); $this->assertEquals(0, $this->_registration->getCurrentCallCount()); $callMsg = new \Thruway\Message\CallMessage(\Thruway\Session::getUniqueId(), new \stdClass(), 'test_procedure'); $call = new \Thruway\Call($mockSession, $callMsg); $this->_registration->processCall($call); $this->assertEquals(1, $this->_registration->getCurrentCallCount()); }