Unverified Commit 8a21c170 authored by Kim Hemsø Rasmussen's avatar Kim Hemsø Rasmussen Committed by Marco Pivetta

Removed unnecessary assertions and method arguments.

Fixed cs issues
parent bc101552
...@@ -778,7 +778,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -778,7 +778,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
); );
} }
public function testShouldNotPassPlatformInParamsToTheQueryCacheProfileInExecuteCacheQuery() /**
* @group DBAL-2821
*/
public function testShouldNotPassPlatformInParamsToTheQueryCacheProfileInExecuteCacheQuery(): void
{ {
$resultCacheDriverMock = $this->createMock(Cache::class); $resultCacheDriverMock = $this->createMock(Cache::class);
...@@ -788,10 +791,6 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -788,10 +791,6 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->with('cacheKey') ->with('cacheKey')
->will($this->returnValue(['realKey' => []])); ->will($this->returnValue(['realKey' => []]));
$query = 'SELECT * FROM foo WHERE bar = ?';
$params = [666];
$types = [\PDO::PARAM_INT];
/* @var $queryCacheProfileMock QueryCacheProfile|\PHPUnit_Framework_MockObject_MockObject */ /* @var $queryCacheProfileMock QueryCacheProfile|\PHPUnit_Framework_MockObject_MockObject */
$queryCacheProfileMock = $this->createMock(QueryCacheProfile::class); $queryCacheProfileMock = $this->createMock(QueryCacheProfile::class);
...@@ -800,25 +799,23 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -800,25 +799,23 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->method('getResultCacheDriver') ->method('getResultCacheDriver')
->will($this->returnValue($resultCacheDriverMock)); ->will($this->returnValue($resultCacheDriverMock));
$connectionParams = $this->params; $query = 'SELECT 1';
$expectedParams = $connectionParams;
$connectionParams["platform"] = $this->createMock(AbstractPlatform::class); $connectionParams = $this->params;
// This is our main expectation // This is our main expectation
$queryCacheProfileMock $queryCacheProfileMock
->expects($this->once()) ->expects($this->once())
->method('generateCacheKeys') ->method('generateCacheKeys')
->with($query, $params, $types, $expectedParams) ->with($query, [], [], $connectionParams)
->will($this->returnValue(['cacheKey', 'realKey'])); ->will($this->returnValue(['cacheKey', 'realKey']));
$connectionParams['platform'] = $this->createMock(AbstractPlatform::class);
/* @var $driver Driver */ /* @var $driver Driver */
$driver = $this->createMock(Driver::class); $driver = $this->createMock(Driver::class);
$this->assertInstanceOf( (new Connection($connectionParams, $driver))->executeCacheQuery($query, [], [], $queryCacheProfileMock);
ArrayStatement::class,
(new Connection($connectionParams, $driver))->executeCacheQuery($query, $params, $types, $queryCacheProfileMock)
);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment