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
00f13ca3
Commit
00f13ca3
authored
May 02, 2017
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected PHPUnit mocks usages
parent
2bd4b79c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
ConnectionTest.php
tests/Doctrine/Tests/DBAL/ConnectionTest.php
+10
-6
DB2SchemaManagerTest.php
tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php
+7
-7
No files found.
tests/Doctrine/Tests/DBAL/ConnectionTest.php
View file @
00f13ca3
...
...
@@ -2,9 +2,12 @@
namespace
Doctrine\Tests\DBAL
;
use
Doctrine\Common\Cache\Cache
;
use
Doctrine\Common\EventManager
;
use
Doctrine\DBAL\Cache\QueryCacheProfile
;
use
Doctrine\DBAL\Configuration
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Events
;
use
Doctrine\Tests\Mocks\DriverConnectionMock
;
use
Doctrine\Tests\Mocks\DriverMock
;
...
...
@@ -673,7 +676,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public
function
testConnectionParamsArePassedToTheQueryCacheProfileInExecuteCacheQuery
()
{
$resultCacheDriverMock
=
$this
->
getMock
(
'Doctrine\Common\Cache\Cache'
);
$resultCacheDriverMock
=
$this
->
createMock
(
Cache
::
class
);
$resultCacheDriverMock
->
expects
(
$this
->
atLeastOnce
())
->
method
(
'fetch'
)
...
...
@@ -684,7 +687,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$params
=
array
(
666
);
$types
=
array
(
\PDO
::
PARAM_INT
);
$queryCacheProfileMock
=
$this
->
getMock
(
'Doctrine\DBAL\Cache\QueryCacheProfile'
);
/* @var $queryCacheProfileMock QueryCacheProfile|\PHPUnit_Framework_MockObject_MockObject */
$queryCacheProfileMock
=
$this
->
createMock
(
QueryCacheProfile
::
class
);
$queryCacheProfileMock
->
expects
(
$this
->
any
())
->
method
(
'getResultCacheDriver'
)
...
...
@@ -696,10 +700,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->
with
(
$query
,
$params
,
$types
,
$this
->
params
)
->
will
(
$this
->
returnValue
(
array
(
'cacheKey'
,
'realKey'
)));
$conn
=
new
Connection
(
$this
->
params
,
$this
->
getMock
(
'Doctrine\DBAL\Driver'
)
);
/* @var $driver Driver */
$driver
=
$this
->
createMock
(
Driver
::
class
);
$conn
=
new
Connection
(
$this
->
params
,
$driver
);
$this
->
assertInstanceOf
(
'Doctrine\DBAL\Cache\ArrayStatement'
,
$conn
->
executeCacheQuery
(
$query
,
$params
,
$types
,
$queryCacheProfileMock
)
...
...
tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php
View file @
00f13ca3
...
...
@@ -27,13 +27,13 @@ final class DB2SchemaManagerTest extends \PHPUnit_Framework_TestCase
protected
function
setUp
()
{
$eventManager
=
new
EventManager
();
$driverMock
=
$this
->
get
Mock
(
Driver
::
class
);
$platform
=
$this
->
get
Mock
(
DB2Platform
::
class
);
$this
->
conn
=
$this
->
getMock
(
Connection
::
class
,
[
'fetchAll'
],
[[
'platform'
=>
$platform
],
$driverMock
,
new
Configuration
(),
$eventManager
]
);
$driverMock
=
$this
->
create
Mock
(
Driver
::
class
);
$platform
=
$this
->
create
Mock
(
DB2Platform
::
class
);
$this
->
conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
setMethods
([
'fetchAll'
])
->
setConstructorArgs
([[
'platform'
=>
$platform
],
$driverMock
,
new
Configuration
(),
$eventManager
])
->
getMock
(
);
$this
->
manager
=
new
DB2SchemaManager
(
$this
->
conn
);
}
...
...
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