Commit 00f13ca3 authored by Marco Pivetta's avatar Marco Pivetta

Corrected PHPUnit mocks usages

parent 2bd4b79c
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
namespace Doctrine\Tests\DBAL; namespace Doctrine\Tests\DBAL;
use Doctrine\Common\Cache\Cache;
use Doctrine\Common\EventManager; use Doctrine\Common\EventManager;
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
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;
...@@ -673,7 +676,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -673,7 +676,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testConnectionParamsArePassedToTheQueryCacheProfileInExecuteCacheQuery() public function testConnectionParamsArePassedToTheQueryCacheProfileInExecuteCacheQuery()
{ {
$resultCacheDriverMock = $this->getMock('Doctrine\Common\Cache\Cache'); $resultCacheDriverMock = $this->createMock(Cache::class);
$resultCacheDriverMock->expects($this->atLeastOnce()) $resultCacheDriverMock->expects($this->atLeastOnce())
->method('fetch') ->method('fetch')
...@@ -684,7 +687,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -684,7 +687,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$params = array(666); $params = array(666);
$types = array(\PDO::PARAM_INT); $types = array(\PDO::PARAM_INT);
$queryCacheProfileMock = $this->getMock('Doctrine\DBAL\Cache\QueryCacheProfile'); /* @var $queryCacheProfileMock QueryCacheProfile|\PHPUnit_Framework_MockObject_MockObject */
$queryCacheProfileMock = $this->createMock(QueryCacheProfile::class);
$queryCacheProfileMock->expects($this->any()) $queryCacheProfileMock->expects($this->any())
->method('getResultCacheDriver') ->method('getResultCacheDriver')
...@@ -696,10 +700,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -696,10 +700,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->with($query, $params, $types, $this->params) ->with($query, $params, $types, $this->params)
->will($this->returnValue(array('cacheKey', 'realKey'))); ->will($this->returnValue(array('cacheKey', 'realKey')));
$conn = new Connection( /* @var $driver Driver */
$this->params, $driver = $this->createMock(Driver::class);
$this->getMock('Doctrine\DBAL\Driver')
); $conn = new Connection($this->params, $driver);
$this->assertInstanceOf('Doctrine\DBAL\Cache\ArrayStatement', $this->assertInstanceOf('Doctrine\DBAL\Cache\ArrayStatement',
$conn->executeCacheQuery($query, $params, $types, $queryCacheProfileMock) $conn->executeCacheQuery($query, $params, $types, $queryCacheProfileMock)
......
...@@ -27,13 +27,13 @@ final class DB2SchemaManagerTest extends \PHPUnit_Framework_TestCase ...@@ -27,13 +27,13 @@ final class DB2SchemaManagerTest extends \PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
$eventManager = new EventManager(); $eventManager = new EventManager();
$driverMock = $this->getMock(Driver::class); $driverMock = $this->createMock(Driver::class);
$platform = $this->getMock(DB2Platform::class); $platform = $this->createMock(DB2Platform::class);
$this->conn = $this->getMock( $this->conn = $this
Connection::class, ->getMockBuilder(Connection::class)
['fetchAll'], ->setMethods(['fetchAll'])
[['platform' => $platform], $driverMock, new Configuration(), $eventManager] ->setConstructorArgs([['platform' => $platform], $driverMock, new Configuration(), $eventManager])
); ->getMock();
$this->manager = new DB2SchemaManager($this->conn); $this->manager = new DB2SchemaManager($this->conn);
} }
......
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