Skip to content

Commit b569698

Browse files
committed
Add MSSQL setup to Azure Pipelines build
1 parent 65c7891 commit b569698

13 files changed

+38
-4
lines changed

azure/apt.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ steps:
4040
postgresql-contrib \
4141
snmpd \
4242
snmp-mibs-downloader \
43+
freetds-dev \
4344
unixodbc-dev \
4445
llvm \
4546
libc-client-dev \

azure/configure.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ steps:
6363
--with-imap-ssl \
6464
--with-pdo-odbc=unixODBC,/usr \
6565
--with-pdo-firebird \
66+
--with-pdo-dblib \
6667
--enable-werror \
6768
--with-config-file-path=/etc \
6869
--with-config-file-scan-dir=/etc/php.d

azure/coverage_job.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
pool:
1111
vmImage: 'ubuntu-18.04'
1212
steps:
13+
- template: mssql.yml
1314
- template: apt.yml
1415
- script: |
1516
sudo -H pip install gcovr

azure/file_cache_job.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
pool:
1111
vmImage: 'ubuntu-18.04'
1212
steps:
13+
- template: mssql.yml
1314
- template: apt.yml
1415
- template: configure.yml
1516
parameters:

azure/job.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
pool:
1111
vmImage: 'ubuntu-20.04'
1212
steps:
13+
- template: mssql.yml
1314
- template: apt.yml
1415
- template: configure.yml
1516
parameters:

azure/mssql.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# this template should be included close to the beginning, before setup.yml
2+
# the container needs time to come up or the sqlcmd operation in setup.yml will have a login timeout
3+
steps:
4+
- script: docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04
5+
displayName: 'Start MSSQL container'

azure/setup.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ steps:
77
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
88
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
99
sudo -u postgres psql -c "CREATE DATABASE test;"
10+
docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "<YourStrong@Passw0rd>" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;"
1011
displayName: 'Setup'
1112
- script: ./azure/setup-slapd.sh
1213
displayName: 'Configure slapd'

azure/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ steps:
99
export PDO_MYSQL_TEST_DSN="mysql:host=localhost;dbname=test"
1010
export PDO_MYSQL_TEST_USER=root
1111
export PDO_MYSQL_TEST_PASS=root
12+
export PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0"
13+
export PDO_DBLIB_TEST_USER="pdo_test"
14+
export PDO_DBLIB_TEST_PASS="password"
1215
export TEST_PHP_JUNIT=junit.xml
1316
export REPORT_EXIT_STATUS=no
1417
export SKIP_IO_CAPTURE_TESTS=1

ext/pdo/tests/bug_73234.phpt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
1515

1616
$db = PDOTest::factory();
1717
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
18-
$db->exec('CREATE TABLE test(id INT)');
18+
19+
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
20+
case 'dblib':
21+
$sql = 'CREATE TABLE test(id INT NULL)';
22+
break;
23+
default:
24+
$sql = 'CREATE TABLE test(id INT)';
25+
break;
26+
}
27+
$db->exec($sql);
1928

2029
$stmt = $db->prepare('INSERT INTO test VALUES(:value)');
2130

ext/pdo_dblib/tests/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# The pdo_mysql extension tests
2+
3+
This extension can be tested using Microsoft's Docker image for [SQL Server on Linux](https://hub.docker.com/_/microsoft-mssql-server):
4+
5+
```bash
6+
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-latest
7+
docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "<YourStrong@Passw0rd>" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;"
8+
9+
# and then from the root of php-src
10+
PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0" PDO_DBLIB_TEST_USER="pdo_test" PDO_DBLIB_TEST_PASS="password" TESTS=ext/pdo_dblib make test
11+
```

ext/pdo_dblib/tests/bug_45876.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ array(10) {
3131
["native_usertype_id"]=>
3232
int(%d)
3333
["pdo_type"]=>
34-
int(2)
34+
int(3)
3535
["name"]=>
3636
string(13) "TABLE_CATALOG"
3737
["len"]=>

ext/pdo_dblib/tests/pdo_dblib_param_str_natl.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ Key: Name: [6] :value
2323
paramno=-1
2424
name=[6] ":value"
2525
is_param=1
26-
param_type=1073741826
26+
param_type=1073741827
2727
NULL

ext/pdo_dblib/tests/types.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ string(19) "2030-01-01 23:59:59"
7777
string(1) "0"
7878
bool(true)
7979
string(4) "1000"
80-
string(5) "10.50"
80+
string(7) "10.5000"
8181
string(19) "1950-01-18 23:00:00"
8282
string(1) "1"

0 commit comments

Comments
 (0)