/**
  *
  */
 public function testAddOuterLayer()
 {
     $onion = new Onion();
     $onion->addOuterLayer(FooMiddleware1::class);
     $onion->addOuterLayer(FooMiddleware2::class);
     $result = $onion->peel(new Foo());
     $this->assertSame('MW2BMW1BfooMW1AMW2A', $result);
 }
Example #2
0
 /**
  * Adds middleware.
  *
  * @access  public
  * @param   string   $middleware  Middleware class
  * @param   boolean  $inner       Add an inner layer?
  * @return  int
  */
 public function addMiddleware($middleware, $inner = true)
 {
     return $inner ? $this->onion->addInnerLayer($middleware) : $this->onion->addOuterLayer($middleware);
 }