コード例 #1
0
 function testCallBack()
 {
     $args = [];
     $callBack = function ($user, $pass) use(&$args) {
         $args = [$user, $pass];
         return true;
     };
     $backend = new BasicCallBack($callBack);
     $request = Sapi::createFromServerArray(['HTTP_AUTHORIZATION' => 'Basic ' . base64_encode('foo:bar')]);
     $response = new Response();
     $this->assertEquals([true, 'principals/foo'], $backend->check($request, $response));
     $this->assertEquals(['foo', 'bar'], $args);
 }