Beispiel #1
0
 public function testInvokeNonMappedEvent()
 {
     $this->busProxy->setGate(new Gate());
     $mockEvent = new MockEvent();
     $this->assertFalse($this->busProxy->publishEvent($mockEvent));
 }
Beispiel #2
0
 /**
  * attach bus
  *
  * @param BusInterface $bus
  * @throws Gate\GateException
  */
 public function attach(BusInterface $bus)
 {
     $bus->setGate($this);
     if ($bus->getName() == AbstractBus::SYSTEMBUS) {
         if (!$bus instanceof SystemBus) {
             throw GateException::attachError(sprintf('Bus <%s> is reserved!', $bus->getName()));
         }
         if (!is_null($this->systemBus)) {
             throw GateException::attachError('SystemBus is already attached!');
         }
         $this->systemBus = $bus;
         return;
     }
     if (isset($this->buses[$bus->getName()])) {
         throw GateException::attachError(sprintf('Bus <%s> is already attached!', $bus->getName()));
     }
     $proxy = new BusProxy($bus);
     $proxy->setGate($this);
     $this->buses[$bus->getName()] = $proxy;
 }