isAuthorized() 공개 메소드

Returns true if the target url is authorized for the logged in user
public isAuthorized ( string | array | null $url = null ) : boolean
$url string | array | null url that the user is making request.
리턴 boolean
예제 #1
0
 /**
  * Test isAuthorized
  *
  * @return void
  */
 public function testIsAuthorized()
 {
     $view = new View();
     $eventManagerMock = $this->getMockBuilder('Cake\\Event\\EventManager')->setMethods(['dispatch'])->getMock();
     $view->eventManager($eventManagerMock);
     $this->AuthLink = new AuthLinkHelper($view);
     $result = new Event('dispatch-result');
     $result->result = true;
     $eventManagerMock->expects($this->once())->method('dispatch')->will($this->returnValue($result));
     $result = $this->AuthLink->isAuthorized(['controller' => 'MyController', 'action' => 'myAction']);
     $this->assertTrue($result);
 }