예제 #1
0
파일: test.php 프로젝트: rokite/windwalker
}
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();
예제 #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());
 }