Skip to content

Fixed the skipif wordings and styles #1070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile-msphpsql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
make \
php7.3 \
php7.3-dev \
php7.3-intl \
python-pip \
re2c \
unixodbc-dev \
Expand Down
15 changes: 9 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
displayName: 'Build and install drivers'

- job: Linux
variables:
phpver: 7.3
pool:
vmImage: 'ubuntu-18.04'
steps:
Expand All @@ -72,13 +74,13 @@ jobs:
architecture: 'x64'

- script: |
sudo update-alternatives --set php /usr/bin/php$(phpVersion)
sudo update-alternatives --set phar /usr/bin/phar$(phpVersion)
sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion)
sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion)
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion)
sudo update-alternatives --set php /usr/bin/php$(phpver)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is because PHP 7.4 is not yet available in the standard repos?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, as of today :)

sudo update-alternatives --set phar /usr/bin/phar$(phpver)
sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpver)
sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpver)
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpver)
php -version
displayName: 'Use PHP version $(phpVersion)'
displayName: 'Use PHP version $(phpver)'

- script: |
echo install ODBC and dependencies
Expand Down Expand Up @@ -128,6 +130,7 @@ jobs:

- script: |
echo ready to build extensions
sudo apt-get install -y php$(phpver)-intl
cd $(Build.SourcesDirectory)/source
chmod a+x packagize.sh
./packagize.sh
Expand Down
8 changes: 4 additions & 4 deletions test/functional/pdo_sqlsrv/pdo_1063_locale_configs.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Current LC_CTYPE: en_US.UTF-8
Setting LC_ALL: en_US.ISO-8859-1
Currency symbol: $
Thousands_sep: ,
Amount formatted: USD 10,000.99
Amount formatted: $10,000.99
Friday
December
3.14159
Expand All @@ -71,7 +71,7 @@ Current LC_CTYPE: en_US.UTF-8
Setting LC_ALL: de_DE.UTF-8
Currency symbol: €
Thousands_sep: .
Amount formatted: 10.000,99 EUR
Amount formatted: 10.000,99 €
Freitag
Dezember
3,14159
Expand All @@ -85,7 +85,7 @@ Current LC_MONETARY: en_US.UTF-8
Current LC_CTYPE: en_US.UTF-8
Currency symbol: $
Thousands_sep: ,
Amount formatted: USD 10,000.99
Amount formatted: $10,000.99
Friday
December
3.14159
Expand All @@ -96,7 +96,7 @@ Current LC_CTYPE: en_US.UTF-8
Setting LC_ALL: de_DE.UTF-8
Currency symbol: €
Thousands_sep: .
Amount formatted: 10.000,99 EUR
Amount formatted: 10.000,99 €
Freitag
Dezember
3,14159
Expand Down
28 changes: 23 additions & 5 deletions test/functional/pdo_sqlsrv/pdo_1063_test_locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ function dropTable($conn, $tableName)
$conn->exec($tsql);
}

function printMoney($amt)
{
// The money_format() function is deprecated in PHP 7.4, so use intl NumberFormatter
$info = localeconv();
echo "Currency symbol: " . $info['currency_symbol'] . PHP_EOL;
echo "Thousands_sep: " . $info['thousands_sep'] . PHP_EOL;

$loc = setlocale(LC_MONETARY, 0);
$symbol = $info['int_curr_symbol'];

echo "Amount formatted: ";
if (empty($symbol)) {
echo number_format($amt, 2, '.', '');
} else {
$fmt = new NumberFormatter($loc, NumberFormatter::CURRENCY);
$fmt->setTextAttribute(NumberFormatter::CURRENCY_CODE, $symbol);
$fmt->setAttribute(NumberFormatter::FRACTION_DIGITS, 2);
echo $fmt->format($amt);
}
echo PHP_EOL;
}

// This test is invoked by pdo_1063_locale_configs.phpt
require_once('MsSetup.inc');
Expand All @@ -21,12 +42,9 @@ function dropTable($conn, $tableName)
echo "Setting LC_ALL: " . $loc . PHP_EOL;
}

$info = localeconv();
echo "Currency symbol: " . $info['currency_symbol'] . PHP_EOL;
echo "Thousands_sep: " . $info['thousands_sep'] . PHP_EOL;

$n1 = 10000.98765;
echo "Amount formatted: " . money_format("%i", $n1) . PHP_EOL;
printMoney($n1);

echo strftime("%A", strtotime("12/25/2020")) . PHP_EOL;
echo strftime("%B", strtotime("12/25/2020")) . PHP_EOL;

Expand Down
6 changes: 3 additions & 3 deletions test/functional/pdo_sqlsrv/skipif.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv'))
die("PDO driver cannot be loaded; skipping test.\n");
?>
if (!extension_loaded("pdo_sqlsrv")) {
die("skip Extension not loaded");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why get rid of the closing ?>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the closing tag of a PHP block at the end of a file is actually optional

12 changes: 6 additions & 6 deletions test/functional/pdo_sqlsrv/skipif_azure.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv'))
die("PDO driver cannot be loaded; skipping test.\n");
if (!extension_loaded("pdo_sqlsrv")) {
die("skip Extension not loaded");
}
require 'MsSetup.inc';
if ($daasMode) die("skip test not applicable in Azure\n");

?>
if ($daasMode) {
die("skip test not applicable in Azure\n");
}
34 changes: 17 additions & 17 deletions test/functional/pdo_sqlsrv/skipif_mid-refactor.inc
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv')) {
die("PDO driver cannot be loaded; skipping test.\n");
}
require_once("MsSetup.inc");
require_once("MsCommon_mid-refactor.inc");
$dsn = getDSN($server, null);
$conn = new PDO($dsn, $uid, $pwd);
if (! $conn) {
echo("Error: could not connect during SKIPIF!");
} elseif (isColEncrypted()) {
if (!isAEQualified($conn)) {
die("skip - AE feature not supported in the current environment.");
}
}
<?php
if (!extension_loaded("pdo_sqlsrv")) {
die("skip Extension not loaded");
}

require_once("MsSetup.inc");
require_once("MsCommon_mid-refactor.inc");

$dsn = getDSN($server, null);
$conn = new PDO($dsn, $uid, $pwd);
if (! $conn) {
die("skip could not connect during SKIPIF!");
} elseif (isColEncrypted()) {
if (!isAEQualified($conn)) {
die("skip - AE feature not supported in the current environment.");
}
}
49 changes: 25 additions & 24 deletions test/functional/pdo_sqlsrv/skipif_not_akv.inc
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<?php
if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv')) {
die("PDO driver cannot be loaded; skipping test.\n");
}

require_once("MsSetup.inc");

if ($keystore != 'akv')
die ( 'skip - the test requires valid Azure Key Vault credentials.' );

if ($driver != "ODBC Driver 17 for SQL Server") {
// the testing is not set to use ODBC 17
die("skip - AE feature not supported in the current environment.");
}

require_once("MsCommon_mid-refactor.inc");

$dsn = getDSN($server, null);
$conn = new PDO($dsn, $uid, $pwd);
if (! $conn) {
echo("Error: could not connect during SKIPIF!");
} elseif (!isAEQualified($conn)) {
die("skip - AE feature not supported in the current environment.");
}
<?php
if (!extension_loaded("pdo_sqlsrv")) {
die("skip Extension not loaded");
}

require_once("MsSetup.inc");

if ($keystore != 'akv') {
die('skip the test requires valid Azure Key Vault credentials.');
}

if ($driver != "ODBC Driver 17 for SQL Server") {
// the testing is not set to use ODBC 17
die("skip AE feature not supported in the current environment.");
}

require_once("MsCommon_mid-refactor.inc");

$dsn = getDSN($server, null);
$conn = new PDO($dsn, $uid, $pwd);
if (! $conn) {
die("skip could not connect during SKIPIF!");
} elseif (!isAEQualified($conn)) {
die("skip AE feature not supported in the current environment.");
}
11 changes: 6 additions & 5 deletions test/functional/pdo_sqlsrv/skipif_unix.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

if ( !( strtoupper( substr( php_uname( 's' ),0,3 ) ) === 'WIN' ) ) die( "Skip, test on windows only." );
if (!(strtoupper(substr(php_uname('s'), 0, 3)) === 'WIN')) {
die("Skip test on windows only.");
}

if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv'))
die("PDO driver cannot be loaded; skipping test.\n");

?>
if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv')) {
die("skip extension not loaded");
}
13 changes: 6 additions & 7 deletions test/functional/pdo_sqlsrv/skipif_unix_locales.inc
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<?php

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
die("Skipped: Test for Linux and macOS");
die("skip Test for Linux and macOS");
}

if (!extension_loaded("sqlsrv")) {
die("skip extension not loaded");
if (!extension_loaded("pdo_sqlsrv")) {
die("skip Extension not loaded");
}

// check if the required ini file exists
$inifile = PHP_CONFIG_FILE_SCAN_DIR."/99-overrides.ini";
if (!file_exists($inifile)) {
die("required ini file not exists");
die("skip required ini file not exists");
}

// if the file exists, is it writable? '@' sign is used to suppress warnings
$file = @fopen($inifile, "w");
if (!$file) {
die("required ini file not writable");
die("skip required ini file not writable");
}

fclose($file);

$loc = setlocale(LC_TIME, 'de_DE.UTF-8');
if (empty($loc)) {
die("required locale not available");
die("skip required locale not available");
}
?>
21 changes: 9 additions & 12 deletions test/functional/pdo_sqlsrv/skipif_versions_old.inc
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<?php

if (! extension_loaded( 'pdo' ) || ! extension_loaded( 'pdo_sqlsrv' ))
die( "PDO driver cannot be loaded; skipping test.\n" );
if (!extension_loaded("pdo_sqlsrv")) {
die("skip Extension not loaded");
}

require_once( "MsSetup.inc" );
require_once( "MsCommon.inc" );
require_once("MsSetup.inc");
require_once("MsCommon.inc");

$conn = ae_connect();
if( ! $conn )
{
echo( "Error: could not connect during SKIPIF!" );
}
else if(! IsAEQualified($conn))
{
die( "skip - AE feature not supported in the current environment." );
if (! $conn) {
die("skip could not connect during SKIPIF!");
} elseif (! IsAEQualified($conn)) {
die("skip AE feature not supported in the current environment.");
}
?>
48 changes: 24 additions & 24 deletions test/functional/sqlsrv/skipif_not_akv.inc
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php
if (! extension_loaded("sqlsrv")) {
die("skip extension not loaded");
}
require_once("MsSetup.inc");
if ($keystore != 'akv')
die ( 'skip - the test requires valid Azure Key Vault credentials.' );
if ($driver != "ODBC Driver 17 for SQL Server") {
// the testing is not set to use ODBC 17
die("skip - AE feature not supported in the current environment.");
}
require_once('MsCommon.inc');
$conn = AE\connect();
if (! $conn) {
echo("Error: could not connect during SKIPIF!");
} elseif (!AE\isQualified($conn)) {
die("skip - AE feature not supported in the current environment.");
}
?>
<?php

if (! extension_loaded("sqlsrv")) {
die("skip extension not loaded");
}

require_once("MsSetup.inc");
if ($keystore != 'akv') {
die('skip the test requires valid Azure Key Vault credentials.');
}

if ($driver != "ODBC Driver 17 for SQL Server") {
// the testing is not set to use ODBC 17
die("skip AE feature not supported in the current environment.");
}

require_once('MsCommon.inc');

$conn = AE\connect();
if (! $conn) {
die("skip could not connect during SKIPIF!");
} elseif (!AE\isQualified($conn)) {
die("skip AE feature not supported in the current environment.");
}
6 changes: 3 additions & 3 deletions test/functional/sqlsrv/skipif_unix.inc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

if ( !( strtoupper( substr( php_uname( 's' ),0,3 ) ) === 'WIN' ) ) die( "Skip, test on windows only." );
if (!(strtoupper(substr(php_uname('s'), 0, 3)) === 'WIN')) {
die("Skip Test on windows only.");
}

if (!extension_loaded("sqlsrv")) {
die("skip extension not loaded");
}

?>
Loading