/** * Add a layer to the stack * * @param ProtocolLayer\ProtocolLayerInterface $layer * @param constant $placement (self::LAYER_PLACEMENT_*) * @return Server */ public function addProtocolLayer(ProtocolLayer\ProtocolLayerInterface $layer, $placement) { $this->protocolLayerStack->addLayer($layer, $placement, $this->currentProtocolLayer); $this->currentProtocolLayer = $layer; return $this; }
public function testHandleRequest() { $stack = new ProtocolLayerStack(); $layerA = new \ClientProtocolLayer(); $layerB = new \ClientProtocolLayer(); $stack->addLayer($layerA, ProtocolLayerStack::PLACEMENT_TOP); $stack->addLayer($layerB, ProtocolLayerStack::PLACEMENT_TOP); $resultA = $stack->handleRequest('hello'); $resultB = $stack->handleRequest('something'); $this->assertEquals('world', $resultA); $this->assertEquals('something', $resultB); }