Пример #1
0
 /**
  * Test that the configuration options work.
  *
  * @return void
  */
 public function testConfigurationValidate()
 {
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $controller = $this->getMock('Cake\\Controller\\Controller', ['redirect']);
     $controller->request = new Request(['cookies' => ['csrfToken' => 'nope', 'token' => 'yes'], 'post' => ['_csrfToken' => 'no match', 'token' => 'yes']]);
     $controller->response = new Response();
     $component = new CsrfComponent($this->registry, ['cookieName' => 'token', 'field' => 'token', 'expiry' => 90]);
     $event = new Event('Controller.startup', $controller);
     $result = $component->startUp($event);
     $this->assertNull($result, 'Config settings should work.');
 }