Example #1
0
class TestB extends Middleware
{
    /**
     * call
     *
     * @return  mixed
     */
    public function call()
    {
        echo "BBBB\n";
        $this->next->call();
        echo "BBBB\n";
    }
}
//$a = new TestA;
//$b = new TestB;
//
//$a->setNext($b);
//$b->setNext(new CallbackMiddleware(
//	function($next)
//	{
//		echo "CCCC\n";
//		echo "CCCC\n";
//	}
//));
//
//$a->call();
$c = new ChainBuilder();
$c->add('TestA')->add(new TestB());
$c->call();
Example #2
0
 /**
  * Method to test call().
  *
  * @return void
  *
  * @covers Windwalker\Middleware\Chain\ChainBuilder::call
  */
 public function testCall()
 {
     $data = ">>> Caesar\n>>> Othello\n<<< Othello\n<<< Caesar";
     $this->assertStringDataEquals($data, $this->instance->call());
 }