Made the tests more robust

This commit is contained in:
yitam 2021-12-06 18:01:03 -08:00
parent dad6e4c245
commit 84e7d67aec
2 changed files with 18 additions and 22 deletions

View file

@ -1,5 +1,8 @@
--TEST--
Test various encrypt attributes
--DESCRIPTION--
This test does not test if any connection is successful but mainly test if the Encrypt keyword takes
different attributes.
--SKIPIF--
<?php require('skipif.inc');?>
--FILE--

View file

@ -1,5 +1,8 @@
--TEST--
Test various encrypt attributes
--DESCRIPTION--
This test does not test if any connection is successful but mainly test if the Encrypt keyword takes
different attributes.
--SKIPIF--
<?php require('skipif.inc');?>
--FILE--
@ -9,53 +12,43 @@ require_once 'MsSetup.inc';
echo 'Test case 1' . PHP_EOL;
$connectionOptions = array('Encrypt' => true, 'TrustServerCertificate' => true);
$conn = sqlsrv_connect($server, $connectionOptions);
if ($conn === false) {
die(print_r(sqlsrv_errors(), true));
if ($conn != false) {
sqlsrv_close($conn);
}
sqlsrv_close($conn);
echo 'Test case 2' . PHP_EOL;
$connectionOptions = array('Encrypt' => 1, 'TrustServerCertificate' => true);
$conn = sqlsrv_connect($server, $connectionOptions);
if ($conn === false) {
die(print_r(sqlsrv_errors(), true));
if ($conn != false) {
sqlsrv_close($conn);
}
sqlsrv_close($conn);
echo 'Test case 3' . PHP_EOL;
$connectionOptions = array('Encrypt' => "yes", 'TrustServerCertificate' => true);
$conn = sqlsrv_connect($server, $connectionOptions);
if ($conn === false) {
die(print_r(sqlsrv_errors(), true));
if ($conn != false) {
sqlsrv_close($conn);
}
sqlsrv_close($conn);
echo 'Test case 4' . PHP_EOL;
$connectionOptions = array('Encrypt' => "no");
$conn = sqlsrv_connect($server, $connectionOptions);
if ($conn === false) {
die(print_r(sqlsrv_errors(), true));
if ($conn != false) {
sqlsrv_close($conn);
}
sqlsrv_close($conn);
echo 'Test case 5' . PHP_EOL;
$connectionOptions = array('Encrypt' => false);
$conn = sqlsrv_connect($server, $connectionOptions);
if ($conn === false) {
die(print_r(sqlsrv_errors(), true));
if ($conn != false) {
sqlsrv_close($conn);
}
sqlsrv_close($conn);
echo 'Test case 6' . PHP_EOL;
$connectionOptions = array('Encrypt' => 0);
$conn = sqlsrv_connect($server, $connectionOptions);
if ($conn === false) {
die(print_r(sqlsrv_errors(), true));
if ($conn != false) {
sqlsrv_close($conn);
}
echo 'Test case 7' . PHP_EOL;