/** * Create instances with already registered authorizations */ public function testCreateFromArrayWithRegistered() { $callback = function () { return 1; }; $contextAuthorization = new ContextAuthorization(); $contextAuthorization->initialize($this->context, $callback); ResolvableAuthorizationRegistry::register('registered', $contextAuthorization); $result = ResolvableAuthorizationInstance::getInstance()->createFromArray(['registered']); $this->assertcount(1, $result); $this->assertInstanceOf("ResolveAuth\\Authorization\\Resolvable\\ContextAuthorization", $contextAuthorization); $this->assertSame($callback, $result[0]->params); }
/** * @expectedException InvalidArgumentException * @expectedExceptionMessage Not callable function */ public function testInvalidCallback() { $authorization = new ContextAuthorization(); $authorization->initialize($this->context, ''); }