Commit e374d994 authored by Antonio Vilar's avatar Antonio Vilar Committed by Marco Pivetta

Some test tweaks

parent d19567bc
......@@ -97,7 +97,7 @@ class QueryCacheProfile
*
* @return array
*/
public function generateCacheKeys($query, $params, $types, $connectionParams = array())
public function generateCacheKeys($query, $params, $types, array $connectionParams = array())
{
$realCacheKey = 'query=' . $query .
'&params=' . serialize($params) .
......
......@@ -2,8 +2,6 @@
namespace Doctrine\Tests\DBAL\Cache;
require_once __DIR__ . '/../../TestInit.php';
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\Tests\DbalTestCase;
......@@ -41,7 +39,7 @@ class QueryCacheProfileTest extends DbalTestCase
$connectionParams
);
$this->assertEquals(self::CACHE_KEY, $generatedKeys[0], 'The returned cached key should match the given one');
$this->assertEquals(self::CACHE_KEY, $generatedKeys[0], 'The returned cache key should match the given one');
}
public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven()
......@@ -67,6 +65,12 @@ class QueryCacheProfileTest extends DbalTestCase
$connectionParams
);
$this->assertNotEquals(
self::CACHE_KEY,
$generatedKeys[0],
'The returned cache key should be generated automatically'
);
$this->assertNotEmpty($generatedKeys[0], 'The generated cache key should not be empty');
}
......
......@@ -675,8 +675,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
$resultCacheDriverMock = $this->getMock('Doctrine\Common\Cache\Cache');
$resultCacheDriverMock->expects($this->any())
$resultCacheDriverMock->expects($this->atLeastOnce())
->method('fetch')
->with('cacheKey')
->will($this->returnValue(array('realKey' => array())));
$query = 'SELECT * FROM foo WHERE bar = ?';
......@@ -700,8 +701,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$this->getMock('Doctrine\DBAL\Driver')
);
$result = $conn->executeCacheQuery($query, $params, $types, $queryCacheProfileMock);
$this->assertInstanceOf('Doctrine\DBAL\Cache\ArrayStatement', $result);
$this->assertInstanceOf('Doctrine\DBAL\Cache\ArrayStatement',
$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