public function testPing()
 {
     // ping a valid host (CHB)
     $server_ip = '134.174.12.21';
     $server_port = 104;
     $pacs_ping = new PACS($server_ip, $server_port);
     $result = $pacs_ping->ping();
     // should return 1 on success
     $this->assertTrue($result == 1);
     // ping unvalid host
     $server_port = 10;
     $pacs_ping2 = new PACS($server_ip, $server_port);
     $result2 = $pacs_ping2->ping();
     // should return 0 on failure
     $this->assertTrue($result2 == 0);
 }
$instateLog .= date('Y-m-d h:i:s') . ' ---> Instantiate PACS class...' . PHP_EOL;
$instateLog .= 'Server: ' . $server . PHP_EOL;
$instateLog .= 'Port: ' . $port . PHP_EOL;
$instateLog .= 'AEtitle: ' . $aetitle . PHP_EOL;
$fh = fopen($logFile, 'a') or die("can't open file");
fwrite($fh, $instateLog);
fclose($fh);
$pacs = new PACS($server, $port, $aetitle, $aec);
//
// 3- TEST CONNECTION
//
$connectionLog = '=======================================' . PHP_EOL;
$connectionLog .= date('Y-m-d h:i:s') . ' ---> Test connection to server...' . PHP_EOL;
$connectionLog .= 'Server: ' . $server . PHP_EOL;
$connectionLog .= 'Port: ' . $port . PHP_EOL;
$ping_result = $pacs->ping();
if (is_array($ping_result)) {
    $connectionLog .= "Cannot connect to the server...." . PHP_EOL;
    $connectionLog .= "Stopping pre_process.php " . "Line: " . __LINE__ . PHP_EOL;
    $connectionLog .= "EXIT CODE 1" . PHP_EOL;
    $fh = fopen($logFile, 'a') or die("can't open file");
    fwrite($fh, $connectionLog);
    fclose($fh);
    exit(1);
}
$connectionLog .= "Active connection to the server...." . PHP_EOL;
$fh = fopen($logFile, 'a') or die("can't open file");
fwrite($fh, $connectionLog);
fclose($fh);
//
// 4- QUERY ALL INFORMATION