/**
  * @param $host
  * @param $port
  * @param $blueprintFile
  *
  * @return HttpServer
  */
 protected function createHttpServer($host, $port, $blueprintFile)
 {
     if (!is_file($blueprintFile)) {
         throw new LogicException(s('Blueprint not found at %s.', $blueprintFile));
     }
     $server = new HttpServer($host, $port, $blueprintFile);
     $server->echoMessage(s('Using blueprint file %s', $blueprintFile));
     return $server;
 }
Exemple #2
0
 public function runInHttpMode($file)
 {
     $server = new HttpServer('localhost', 56789, $this->getFilePath($file));
     $server->start();
     $client = new HttpClient();
     $request = new HttpRequest(HttpRequestMethod::GET, new Url('localhost:56789'));
     $response = $client->send($request);
     $server->stop();
     return $response->getContent();
 }
 public function tearDown()
 {
     $this->server->stop();
 }
Exemple #4
0
 public function test_enable_and_disable_output()
 {
     $server = new HttpServer('localhost', 6789, __DIR__);
     $server->enableOutput();
     $server->disableOutput();
 }