getProcedureName() публичный Метод

public getProcedureName ( ) : string
Результат string
Пример #1
0
 public function testMultipleRegistrations()
 {
     $realm = $this->getMockBuilder('\\Thruway\\Realm')->setConstructorArgs(["realm1"])->setMethods(["publishMeta"])->getMock();
     $realm->expects($this->exactly(4))->method('publishMeta')->with($this->equalTo('thruway.metaevent.procedure.congestion'), $this->equalTo([["name" => $this->_proc->getProcedureName()]]));
     // create 5 sessions
     $s = [];
     $currentCallCounts = [];
     $invocationToYield = null;
     for ($i = 0; $i < 5; $i++) {
         $s[$i] = $this->getMockBuilder('\\Thruway\\Session')->disableOriginalConstructor()->setMethods(['sendMessage', 'getRealm'])->getMock();
         if ($i < 2) {
             // TODO: without queuing
             //$s[$i]->expects($this->exactly(3))
             $s[$i]->expects($this->exactly(2))->method("sendMessage")->withConsecutive([$this->isInstanceOf('\\Thruway\\Message\\RegisteredMessage')], [$this->isInstanceOf('\\Thruway\\Message\\InvocationMessage')]);
         } else {
             if ($i == 2) {
                 // TODO: without queuing
                 //$s[$i]->expects($this->exactly(4))
                 $s[$i]->expects($this->exactly(3))->method("sendMessage")->withConsecutive([$this->isInstanceOf('\\Thruway\\Message\\RegisteredMessage')], [$this->isInstanceOf('\\Thruway\\Message\\InvocationMessage')], [$this->isInstanceOf('\\Thruway\\Message\\InvocationMessage')], [$this->isInstanceOf('\\Thruway\\Message\\InvocationMessage')]);
             } else {
                 $s[$i]->expects($this->exactly(2))->method("sendMessage")->withConsecutive([$this->isInstanceOf('\\Thruway\\Message\\RegisteredMessage')], [$this->isInstanceOf('\\Thruway\\Message\\InvocationMessage')]);
             }
         }
         $s[$i]->method('getRealm')->will($this->returnValue($realm));
         $currentCallCounts[$i] = 0;
     }
     $registerMsg = new \Thruway\Message\RegisterMessage(\Thruway\Common\Utils::getUniqueId(), ['thruway_multiregister' => true], 'test_procedure');
     foreach ($s as $i => $session) {
         $this->_proc->processRegister($session, $registerMsg);
     }
     $callMsg = new \Thruway\Message\CallMessage(\Thruway\Common\Utils::getUniqueId(), [], 'test_procedure');
     // call the proc enough to get a backlog
     // should be 2,2,2,1,1 for call depth now (only if not queuing)
     for ($i = 0; $i < 8; $i++) {
         $call = new \Thruway\Call($s[0], $callMsg, $this->_proc);
         $this->_proc->processCall($s[0], $call);
     }
     for ($i = 0; $i < 5; $i++) {
         // TODO: without queuing
         //$this->assertEquals($i < 3 ? 2 : 1, $s[$i]->getPendingCallCount());
         $this->assertEquals(1, $s[$i]->getPendingCallCount());
     }
     // now reset session[2] down to zero and see if that is where the next call goes
     $s[2]->decPendingCallCount();
     // remove the call from the procedure
     // TODO: without queuing
     //$s[2]->decPendingCallCount();
     $this->assertEquals(0, $s[2]->getPendingCallCount());
     $call = new \Thruway\Call($s[0], $callMsg, $this->_proc);
     $this->_proc->processCall($s[0], $call);
 }