Exemplo n.º 1
0
 public function test_server_logging()
 {
     $server = new HttpServer('localhost', 6789, __DIR__);
     $logFile = tempnam(sys_get_temp_dir(), 'php');
     $server->setLogFile($logFile);
     $server->start();
     file_get_contents('http://localhost:6789/test?first');
     file_get_contents('http://localhost:6789/test?second');
     $server->stop();
     $lines = explode("\n", file_get_contents($logFile));
     $this->assertRegExp('/first$/', $lines[0]);
     $this->assertRegExp('/second$/', $lines[1]);
     unlink($logFile);
 }