Skip to content

Commit 8dea64f

Browse files
committed
Add MSSQL
1 parent b8243b1 commit 8dea64f

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ jobs:
6969
ports:
7070
- '5432:5432'
7171

72+
mssql:
73+
image: mcr.microsoft.com/mssql/server:2019-latest
74+
env:
75+
ACCEPT_EULA: Y
76+
SA_PASSWORD: Symfony123
77+
ports:
78+
- 1433:1433
79+
7280
steps:
7381
- name: Checkout code
7482
uses: actions/checkout@v2
@@ -78,13 +86,17 @@ jobs:
7886
with:
7987
php-version: '8.0'
8088
coverage: none
89+
extensions: pdo_sqlsrv
8190

8291
- name: Composer install
8392
uses: ramsey/composer-install@v1
8493

8594
- name: Install PHPUnit
8695
run: vendor/bin/simple-phpunit install
8796

97+
- name: Create MSSQL database
98+
run: 'docker exec ${{ job.services.mssql.id }} /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Symfony123 -Q "CREATE DATABASE acl_test"'
99+
88100
- name: Run functional tests
89101
run: vendor/bin/simple-phpunit --group functional
90102

Tests/Dbal/AclProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected function setUp(): void
156156
foreach ($schema->toDropSql($this->connection->getDatabasePlatform()) as $sql) {
157157
try {
158158
$this->connection->executeStatement($sql);
159-
} catch (TableNotFoundException $e) {
159+
} catch (\Exception $e) {
160160
}
161161
}
162162
}

Tests/Dbal/MSSQL_AclProviderTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Security\Acl\Tests\Dbal;
13+
14+
use Doctrine\DBAL\DriverManager;
15+
16+
/**
17+
* @requires extension pdo_mysql
18+
* @group functional
19+
*/
20+
class MSSQL_AclProviderTest extends AclProviderTest
21+
{
22+
/** @return Connection */
23+
protected function createConnection()
24+
{
25+
$connection = DriverManager::getConnection([
26+
'driver' => 'pdo_sqlsrv',
27+
'host' => '127.0.0.1',
28+
'user' => 'sa',
29+
'password' => 'Symfony123',
30+
'dbname' => 'acl_test',
31+
]);
32+
33+
return $connection;
34+
}
35+
}

0 commit comments

Comments
 (0)