Ejemplo n.º 1
0
 public function testLogRequest()
 {
     $handler = new EchoHandler();
     $request = new ConsoleRequest($handler);
     $response = $request->makeRequest("http://127.0.0.1:23523/", 'POST', ['status' => 'ok', 'message' => 'Hello']);
     $this->assertTrue($response->isError());
     $this->assertEquals('http://127.0.0.1:23523/?status=ok&message=Hello', $response->getUrl());
 }
Ejemplo n.º 2
0
 public function formSucceeded($form, $values)
 {
     $url = $values['api_url'];
     $token = false;
     if (isset($values['token'])) {
         $token = $values['token'];
         unset($values['token']);
     }
     $method = $values['method'];
     unset($values['method']);
     $consoleRequest = new ConsoleRequest($this->handler);
     $result = $consoleRequest->makeRequest($url, $method, (array) $values, $token);
     $this->getTemplate()->add('response', $result);
 }