fixed BVT tests to run on Linux/Mac
This commit is contained in:
parent
7ed7b596c7
commit
b9b785dd9a
|
@ -1,13 +1,16 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
returns an array of PDO drivers
|
check if sqlsrv is in the array of available PDO drivers
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?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--
|
--EXPECT--
|
||||||
Array
|
sqlsrv found
|
||||||
(
|
Done
|
||||||
[0] => sqlsrv
|
|
||||||
)
|
|
|
@ -14,7 +14,7 @@ if( $conn === false )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare and execute the query. */
|
/* 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);
|
$stmt = sqlsrv_prepare( $conn, $tsql);
|
||||||
if( $stmt === false )
|
if( $stmt === false )
|
||||||
{
|
{
|
||||||
|
@ -46,4 +46,4 @@ echo "$count sales accounted for the first $$salesTotal in revenue.\n";
|
||||||
sqlsrv_cancel( $stmt);
|
sqlsrv_cancel( $stmt);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
57 sales accounted for the first $104171.7607 in revenue.
|
58 sales accounted for the first $104205.9607 in revenue.
|
|
@ -2,7 +2,6 @@
|
||||||
disables the default error-handling behaviour using configure and returns warnings
|
disables the default error-handling behaviour using configure and returns warnings
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
|
|
||||||
?>
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
/* Turn off the default behavior of treating errors as warnings.
|
/* Turn off the default behavior of treating errors as warnings.
|
||||||
|
@ -147,23 +146,26 @@ sqlsrv_close( $conn );
|
||||||
/* ------------- Error Handling Functions --------------*/
|
/* ------------- Error Handling Functions --------------*/
|
||||||
function DisplayErrors()
|
function DisplayErrors()
|
||||||
{
|
{
|
||||||
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||||
foreach( $errors as $error )
|
foreach( $errors as $error )
|
||||||
{
|
{
|
||||||
echo "Error: ".$error['message']."\n";
|
echo "Error: ".$error['message']."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function DisplayWarnings()
|
function DisplayWarnings()
|
||||||
{
|
{
|
||||||
$warnings = sqlsrv_errors(SQLSRV_ERR_WARNINGS);
|
$warnings = sqlsrv_errors(SQLSRV_ERR_WARNINGS);
|
||||||
if(!is_null($warnings))
|
if(!is_null($warnings))
|
||||||
{
|
{
|
||||||
foreach( $warnings as $warning )
|
foreach( $warnings as $warning )
|
||||||
{
|
{
|
||||||
echo "Warning: ".$warning['message']."\n";
|
$message = $warning['message'];
|
||||||
}
|
// Skips the message with 'unixODBC' (an unnecessary duplicate message in some platform)
|
||||||
}
|
if (! stripos($message, 'unixODBC') )
|
||||||
|
echo "Warning: $message\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECTREGEX--
|
--EXPECTREGEX--
|
||||||
|
|
|
@ -31,5 +31,5 @@ else
|
||||||
/* Free connection resources. */
|
/* Free connection resources. */
|
||||||
sqlsrv_close( $conn);
|
sqlsrv_close( $conn);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTREGEX--
|
||||||
CurrentDatabase: AdventureWorks2014<br>SQLServerVersion: 12.00.4100<br>SQLServerName: SQL-2K14-SP1-1<br>
|
CurrentDatabase: AdventureWorks.*<br>SQLServerVersion: 1[2-9].00.[0-9]{4}<br>SQLServerName: SQL.+<br>
|
Loading…
Reference in a new issue