Skip to content

Commit

Permalink
CS (alignment, short array syntax), inlining useless variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed May 3, 2017
1 parent db1395b commit c23d80a
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions tests/Doctrine/Tests/DBAL/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Doctrine\DBAL\Events;
use Doctrine\Tests\Mocks\DriverConnectionMock;
use Doctrine\Tests\Mocks\DriverMock;
use Doctrine\DBAL\Cache\ArrayStatement;

class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
Expand Down Expand Up @@ -678,35 +679,37 @@ public function testConnectionParamsArePassedToTheQueryCacheProfileInExecuteCach
{
$resultCacheDriverMock = $this->createMock(Cache::class);

$resultCacheDriverMock->expects($this->atLeastOnce())
$resultCacheDriverMock
->expects($this->atLeastOnce())
->method('fetch')
->with('cacheKey')
->will($this->returnValue(array('realKey' => array())));
->will($this->returnValue(['realKey' => []]));

$query = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666);
$types = array(\PDO::PARAM_INT);
$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())
$queryCacheProfileMock
->expects($this->any())
->method('getResultCacheDriver')
->will($this->returnValue($resultCacheDriverMock));

// This is our main expectation
$queryCacheProfileMock->expects($this->once())
$queryCacheProfileMock
->expects($this->once())
->method('generateCacheKeys')
->with($query, $params, $types, $this->params)
->will($this->returnValue(array('cacheKey', 'realKey')));
->will($this->returnValue(['cacheKey', 'realKey']));

/* @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)
$this->assertInstanceOf(
ArrayStatement::class,
(new Connection($this->params, $driver))->executeCacheQuery($query, $params, $types, $queryCacheProfileMock)
);
}
}

0 comments on commit c23d80a

Please sign in to comment.