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
9d1edb72
Unverified
Commit
9d1edb72
authored
Aug 22, 2017
by
Kim Hemsø Rasmussen
Committed by
Marco Pivetta
Aug 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added failure test where platform from params is passed to QueryCacheProfile::generateCacheKeys()
parent
324f3ac2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
ConnectionTest.php
tests/Doctrine/Tests/DBAL/ConnectionTest.php
+44
-0
No files found.
tests/Doctrine/Tests/DBAL/ConnectionTest.php
View file @
9d1edb72
...
@@ -9,6 +9,7 @@ use Doctrine\DBAL\Configuration;
...
@@ -9,6 +9,7 @@ use Doctrine\DBAL\Configuration;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Events
;
use
Doctrine\DBAL\Events
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\Tests\Mocks\DriverConnectionMock
;
use
Doctrine\Tests\Mocks\DriverConnectionMock
;
use
Doctrine\Tests\Mocks\DriverMock
;
use
Doctrine\Tests\Mocks\DriverMock
;
use
Doctrine\DBAL\Cache\ArrayStatement
;
use
Doctrine\DBAL\Cache\ArrayStatement
;
...
@@ -777,6 +778,49 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
...
@@ -777,6 +778,49 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
);
);
}
}
public
function
testShouldNotPassPlatformInParamsToTheQueryCacheProfileInExecuteCacheQuery
()
{
$resultCacheDriverMock
=
$this
->
createMock
(
Cache
::
class
);
$resultCacheDriverMock
->
expects
(
$this
->
atLeastOnce
())
->
method
(
'fetch'
)
->
with
(
'cacheKey'
)
->
will
(
$this
->
returnValue
([
'realKey'
=>
[]]));
$query
=
'SELECT * FROM foo WHERE bar = ?'
;
$params
=
[
666
];
$types
=
[
\PDO
::
PARAM_INT
];
/* @var $queryCacheProfileMock QueryCacheProfile|\PHPUnit_Framework_MockObject_MockObject */
$queryCacheProfileMock
=
$this
->
createMock
(
QueryCacheProfile
::
class
);
$queryCacheProfileMock
->
expects
(
$this
->
any
())
->
method
(
'getResultCacheDriver'
)
->
will
(
$this
->
returnValue
(
$resultCacheDriverMock
));
$connectionParams
=
$this
->
params
;
$expectedParams
=
$connectionParams
;
$connectionParams
[
"platform"
]
=
$this
->
createMock
(
AbstractPlatform
::
class
);
// This is our main expectation
$queryCacheProfileMock
->
expects
(
$this
->
once
())
->
method
(
'generateCacheKeys'
)
->
with
(
$query
,
$params
,
$types
,
$expectedParams
)
->
will
(
$this
->
returnValue
([
'cacheKey'
,
'realKey'
]));
/* @var $driver Driver */
$driver
=
$this
->
createMock
(
Driver
::
class
);
$this
->
assertInstanceOf
(
ArrayStatement
::
class
,
(
new
Connection
(
$connectionParams
,
$driver
))
->
executeCacheQuery
(
$query
,
$params
,
$types
,
$queryCacheProfileMock
)
);
}
/**
/**
* @group DBAL-990
* @group DBAL-990
*/
*/
...
...
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