Exemple #1
0
 public function setUp()
 {
     $session = new Session();
     new Translator(new Container());
     $this->request = $this->getMock("\\Thelia\\Core\\HttpFoundation\\Request");
     $this->request->expects($this->any())->method("getClientIp")->willReturn("127.0.0.1");
     $this->request->expects($this->any())->method("getSession")->willReturn($session);
     /**
      * Get an example form. We
      */
     $this->form = $this->getMock("\\Thelia\\Form\\FirewallForm", ["buildForm", "getName"], [$this->request]);
     $this->form->expects($this->any())->method('getName')->will($this->returnValue("test_form_firewall"));
     /**
      * Be sure that the firewall is active
      */
     ConfigQuery::write("form_firewall_active", 1);
     ConfigQuery::write("form_firewall_time_to_wait", 60);
     ConfigQuery::write("form_firewall_attempts", 6);
     /**
      * Empty the firewall blacklist between each test
      */
     FormFirewallQuery::create()->find()->delete();
 }