Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
c88c9267
Unverified
Commit
c88c9267
authored
Aug 16, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the possibility to specify driver options in test configuration
parent
76564ab8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
9 deletions
+35
-9
AbstractDriverTest.php
...trine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php
+4
-3
ConnectionTest.php
...ne/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php
+6
-0
DriverTest.php
...ine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php
+6
-0
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+4
-3
SqliteSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+4
-3
TestUtil.php
tests/Doctrine/Tests/TestUtil.php
+11
-0
No files found.
tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php
View file @
c88c9267
...
@@ -28,10 +28,11 @@ abstract class AbstractDriverTest extends DbalFunctionalTestCase
...
@@ -28,10 +28,11 @@ abstract class AbstractDriverTest extends DbalFunctionalTestCase
$params
=
$this
->
connection
->
getParams
();
$params
=
$this
->
connection
->
getParams
();
unset
(
$params
[
'dbname'
]);
unset
(
$params
[
'dbname'
]);
$user
=
$params
[
'user'
]
??
null
;
$user
=
$params
[
'user'
]
??
null
;
$password
=
$params
[
'password'
]
??
null
;
$password
=
$params
[
'password'
]
??
null
;
$driverOptions
=
$params
[
'driverOptions'
]
??
[];
$connection
=
$this
->
driver
->
connect
(
$params
,
$user
,
$password
);
$connection
=
$this
->
driver
->
connect
(
$params
,
$user
,
$password
,
$driverOptions
);
self
::
assertInstanceOf
(
DriverConnection
::
class
,
$connection
);
self
::
assertInstanceOf
(
DriverConnection
::
class
,
$connection
);
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php
View file @
c88c9267
...
@@ -8,6 +8,8 @@ use Doctrine\DBAL\Driver\Mysqli\MysqliException;
...
@@ -8,6 +8,8 @@ use Doctrine\DBAL\Driver\Mysqli\MysqliException;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
Doctrine\Tests\TestUtil
;
use
Doctrine\Tests\TestUtil
;
use
function
array_merge
;
use
const
MYSQLI_OPT_CONNECT_TIMEOUT
;
use
const
MYSQLI_OPT_CONNECT_TIMEOUT
;
/**
/**
...
@@ -54,6 +56,10 @@ class ConnectionTest extends DbalFunctionalTestCase
...
@@ -54,6 +56,10 @@ class ConnectionTest extends DbalFunctionalTestCase
{
{
$params
=
TestUtil
::
getConnectionParams
();
$params
=
TestUtil
::
getConnectionParams
();
if
(
isset
(
$params
[
'driverOptions'
]))
{
$driverOptions
=
array_merge
(
$params
[
'driverOptions'
],
$driverOptions
);
}
return
new
MysqliConnection
(
return
new
MysqliConnection
(
$params
,
$params
,
$params
[
'user'
]
??
''
,
$params
[
'user'
]
??
''
,
...
...
tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php
View file @
c88c9267
...
@@ -9,6 +9,8 @@ use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
...
@@ -9,6 +9,8 @@ use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use
Doctrine\Tests\TestUtil
;
use
Doctrine\Tests\TestUtil
;
use
PDO
;
use
PDO
;
use
function
array_merge
;
/**
/**
* @requires extension pdo_sqlsrv
* @requires extension pdo_sqlsrv
*/
*/
...
@@ -42,6 +44,10 @@ class DriverTest extends AbstractDriverTest
...
@@ -42,6 +44,10 @@ class DriverTest extends AbstractDriverTest
{
{
$params
=
TestUtil
::
getConnectionParams
();
$params
=
TestUtil
::
getConnectionParams
();
if
(
isset
(
$params
[
'driverOptions'
]))
{
$driverOptions
=
array_merge
(
$params
[
'driverOptions'
],
$driverOptions
);
}
return
$this
->
connection
->
getDriver
()
->
connect
(
return
$this
->
connection
->
getDriver
()
->
connect
(
$params
,
$params
,
$params
[
'user'
]
??
''
,
$params
[
'user'
]
??
''
,
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
c88c9267
...
@@ -114,10 +114,11 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
...
@@ -114,10 +114,11 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$params
[
'dbname'
]
=
'test_drop_database'
;
$params
[
'dbname'
]
=
'test_drop_database'
;
}
}
$user
=
$params
[
'user'
]
??
null
;
$user
=
$params
[
'user'
]
??
null
;
$password
=
$params
[
'password'
]
??
null
;
$password
=
$params
[
'password'
]
??
null
;
$driverOptions
=
$params
[
'driverOptions'
]
??
[];
$connection
=
$this
->
connection
->
getDriver
()
->
connect
(
$params
,
$user
,
$password
);
$connection
=
$this
->
connection
->
getDriver
()
->
connect
(
$params
,
$user
,
$password
,
$driverOptions
);
self
::
assertInstanceOf
(
Connection
::
class
,
$connection
);
self
::
assertInstanceOf
(
Connection
::
class
,
$connection
);
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
View file @
c88c9267
...
@@ -43,10 +43,11 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
...
@@ -43,10 +43,11 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$params
=
$this
->
connection
->
getParams
();
$params
=
$this
->
connection
->
getParams
();
$params
[
'dbname'
]
=
'test_drop_database'
;
$params
[
'dbname'
]
=
'test_drop_database'
;
$user
=
$params
[
'user'
]
??
null
;
$user
=
$params
[
'user'
]
??
null
;
$password
=
$params
[
'password'
]
??
null
;
$password
=
$params
[
'password'
]
??
null
;
$driverOptions
=
$params
[
'driverOptions'
]
??
[];
$connection
=
$this
->
connection
->
getDriver
()
->
connect
(
$params
,
$user
,
$password
);
$connection
=
$this
->
connection
->
getDriver
()
->
connect
(
$params
,
$user
,
$password
,
$driverOptions
);
self
::
assertInstanceOf
(
Connection
::
class
,
$connection
);
self
::
assertInstanceOf
(
Connection
::
class
,
$connection
);
...
...
tests/Doctrine/Tests/TestUtil.php
View file @
c88c9267
...
@@ -8,6 +8,9 @@ use PHPUnit\Framework\Assert;
...
@@ -8,6 +8,9 @@ use PHPUnit\Framework\Assert;
use
function
explode
;
use
function
explode
;
use
function
extension_loaded
;
use
function
extension_loaded
;
use
function
strlen
;
use
function
strpos
;
use
function
substr
;
use
function
unlink
;
use
function
unlink
;
/**
/**
...
@@ -190,6 +193,14 @@ class TestUtil
...
@@ -190,6 +193,14 @@ class TestUtil
$parameters
[
$parameter
]
=
$configuration
[
$prefix
.
$parameter
];
$parameters
[
$parameter
]
=
$configuration
[
$prefix
.
$parameter
];
}
}
foreach
(
$configuration
as
$param
=>
$value
)
{
if
(
strpos
(
$param
,
$prefix
.
'driver_option_'
)
!==
0
)
{
continue
;
}
$parameters
[
'driverOptions'
][
substr
(
$param
,
strlen
(
$prefix
.
'driver_option_'
))]
=
$value
;
}
return
$parameters
;
return
$parameters
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment