Merge pull request #436 from yitam/bvtTests

modified BVT tests to run on Linux/Mac
This commit is contained in:
Jenny Tam 2017-06-13 15:43:05 -07:00 committed by GitHub
commit 1eaed774e6
6 changed files with 37 additions and 26 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

@ -1,4 +1,7 @@
This folder mainly contains tests that are derived from the code examples on
https://docs.microsoft.com/en-us/sql/connect/php/pdo-class
https://docs.microsoft.com/en-us/sql/connect/php/pdostatement-class
https://docs.microsoft.com/en-us/sql/connect/php/pdostatement-class
Modify connect.inc with the real credentials to run the tests, using the latest run-tests.php from
https://raw.githubusercontent.com/php/php-src/master/run-tests.php

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>

View file

@ -1,3 +1,6 @@
This folder mainly contains tests that are derived from the code examples on
https://docs.microsoft.com/en-us/sql/connect/php/sqlsrv-driver-api-reference
https://docs.microsoft.com/en-us/sql/connect/php/sqlsrv-driver-api-reference
Modify connect.inc with the real credentials to run the tests, using the latest run-tests.php from
https://raw.githubusercontent.com/php/php-src/master/run-tests.php