Commit c23d80a1 authored by Marco Pivetta's avatar Marco Pivetta

CS (alignment, short array syntax), inlining useless variable

parent db1395b7
...@@ -11,6 +11,7 @@ use Doctrine\DBAL\Driver; ...@@ -11,6 +11,7 @@ use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Events; use Doctrine\DBAL\Events;
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;
class ConnectionTest extends \Doctrine\Tests\DbalTestCase class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{ {
...@@ -678,35 +679,37 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -678,35 +679,37 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{ {
$resultCacheDriverMock = $this->createMock(Cache::class); $resultCacheDriverMock = $this->createMock(Cache::class);
$resultCacheDriverMock->expects($this->atLeastOnce()) $resultCacheDriverMock
->expects($this->atLeastOnce())
->method('fetch') ->method('fetch')
->with('cacheKey') ->with('cacheKey')
->will($this->returnValue(array('realKey' => array()))); ->will($this->returnValue(['realKey' => []]));
$query = 'SELECT * FROM foo WHERE bar = ?'; $query = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666); $params = [666];
$types = array(\PDO::PARAM_INT); $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);
$queryCacheProfileMock->expects($this->any()) $queryCacheProfileMock
->expects($this->any())
->method('getResultCacheDriver') ->method('getResultCacheDriver')
->will($this->returnValue($resultCacheDriverMock)); ->will($this->returnValue($resultCacheDriverMock));
// This is our main expectation // This is our main expectation
$queryCacheProfileMock->expects($this->once()) $queryCacheProfileMock
->expects($this->once())
->method('generateCacheKeys') ->method('generateCacheKeys')
->with($query, $params, $types, $this->params) ->with($query, $params, $types, $this->params)
->will($this->returnValue(array('cacheKey', 'realKey'))); ->will($this->returnValue(['cacheKey', 'realKey']));
/* @var $driver Driver */ /* @var $driver Driver */
$driver = $this->createMock(Driver::class); $driver = $this->createMock(Driver::class);
$conn = new Connection($this->params, $driver); $this->assertInstanceOf(
ArrayStatement::class,
$this->assertInstanceOf('Doctrine\DBAL\Cache\ArrayStatement', (new Connection($this->params, $driver))->executeCacheQuery($query, $params, $types, $queryCacheProfileMock)
$conn->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