fixed BVT tests to run on Linux/Mac

This commit is contained in:
yitam 2017-06-13 11:45:48 -07:00
parent 7ed7b596c7
commit b9b785dd9a
4 changed files with 29 additions and 24 deletions

View file

@ -1,13 +1,16 @@
--TEST--
returns an array of PDO drivers
check if sqlsrv is in the array of available PDO drivers
--SKIPIF--
--FILE--
<?php
print_r(PDO::getAvailableDrivers());
$drivers = PDO::getAvailableDrivers();
if (in_array('sqlsrv', $drivers))
echo "sqlsrv found\n";
else
echo "sqlsrv not found\n";
echo "Done\n";
?>
--EXPECT--
Array
(
[0] => sqlsrv
)
sqlsrv found
Done

View file

@ -14,7 +14,7 @@ if( $conn === false )
}
/* Prepare and execute the query. */
$tsql = "SELECT OrderQty, UnitPrice FROM Sales.SalesOrderDetail";
$tsql = "SELECT OrderQty, UnitPrice FROM Sales.SalesOrderDetail ORDER BY SalesOrderID";
$stmt = sqlsrv_prepare( $conn, $tsql);
if( $stmt === false )
{
@ -46,4 +46,4 @@ echo "$count sales accounted for the first $$salesTotal in revenue.\n";
sqlsrv_cancel( $stmt);
?>
--EXPECT--
57 sales accounted for the first $104171.7607 in revenue.
58 sales accounted for the first $104205.9607 in revenue.

View file

@ -2,7 +2,6 @@
disables the default error-handling behaviour using configure and returns warnings
--SKIPIF--
?>
--FILE--
<?php
/* Turn off the default behavior of treating errors as warnings.
@ -147,23 +146,26 @@ sqlsrv_close( $conn );
/* ------------- Error Handling Functions --------------*/
function DisplayErrors()
{
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
foreach( $errors as $error )
{
echo "Error: ".$error['message']."\n";
}
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
foreach( $errors as $error )
{
echo "Error: ".$error['message']."\n";
}
}
function DisplayWarnings()
{
$warnings = sqlsrv_errors(SQLSRV_ERR_WARNINGS);
if(!is_null($warnings))
{
foreach( $warnings as $warning )
{
echo "Warning: ".$warning['message']."\n";
}
}
$warnings = sqlsrv_errors(SQLSRV_ERR_WARNINGS);
if(!is_null($warnings))
{
foreach( $warnings as $warning )
{
$message = $warning['message'];
// Skips the message with 'unixODBC' (an unnecessary duplicate message in some platform)
if (! stripos($message, 'unixODBC') )
echo "Warning: $message\n";
}
}
}
?>
--EXPECTREGEX--

View file

@ -31,5 +31,5 @@ else
/* Free connection resources. */
sqlsrv_close( $conn);
?>
--EXPECT--
CurrentDatabase: AdventureWorks2014<br>SQLServerVersion: 12.00.4100<br>SQLServerName: SQL-2K14-SP1-1<br>
--EXPECTREGEX--
CurrentDatabase: AdventureWorks.*<br>SQLServerVersion: 1[2-9].00.[0-9]{4}<br>SQLServerName: SQL.+<br>