/** * */ public function testGetBus() { $bus = $this->getBus(); $this->assertEquals($this->bus, $bus); $anotherBus = $this->getBus('test-coverage-mock-another-bus'); $this->assertEquals($this->anotherBus->getName(), $anotherBus->getName()); }
/** * {@inheritDoc} */ public function getName() { return $this->bus->getName(); }
/** * 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; }