Commit 8e8c5a1c authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2435 from deeky666/fix-phpunit-deprecations

Refactor deprecated PHPUnit_Framework_TestCase::getMock() calls
parents 97f423a4 1e67141a
...@@ -102,13 +102,15 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -102,13 +102,15 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testConnectDispatchEvent() public function testConnectDispatchEvent()
{ {
$listenerMock = $this->getMock('ConnectDispatchEventListener', array('postConnect')); $listenerMock = $this->getMockBuilder('ConnectDispatchEventListener')
->setMethods(array('postConnect'))
->getMock();
$listenerMock->expects($this->once())->method('postConnect'); $listenerMock->expects($this->once())->method('postConnect');
$eventManager = new EventManager(); $eventManager = new EventManager();
$eventManager->addEventListener(array(Events::postConnect), $listenerMock); $eventManager->addEventListener(array(Events::postConnect), $listenerMock);
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects(($this->at(0))) $driverMock->expects(($this->at(0)))
->method('connect'); ->method('connect');
$platform = new Mocks\MockPlatform(); $platform = new Mocks\MockPlatform();
...@@ -200,7 +202,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -200,7 +202,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/ */
public function testConnectStartsTransactionInNoAutoCommitMode() public function testConnectStartsTransactionInNoAutoCommitMode()
{ {
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
->will($this->returnValue(new DriverConnectionMock())); ->will($this->returnValue(new DriverConnectionMock()));
...@@ -220,7 +222,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -220,7 +222,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/ */
public function testCommitStartsTransactionInNoAutoCommitMode() public function testCommitStartsTransactionInNoAutoCommitMode()
{ {
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
->will($this->returnValue(new DriverConnectionMock())); ->will($this->returnValue(new DriverConnectionMock()));
...@@ -238,7 +240,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -238,7 +240,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/ */
public function testRollBackStartsTransactionInNoAutoCommitMode() public function testRollBackStartsTransactionInNoAutoCommitMode()
{ {
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
->will($this->returnValue(new DriverConnectionMock())); ->will($this->returnValue(new DriverConnectionMock()));
...@@ -256,7 +258,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -256,7 +258,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/ */
public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions() public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions()
{ {
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
->will($this->returnValue(new DriverConnectionMock())); ->will($this->returnValue(new DriverConnectionMock()));
...@@ -278,7 +280,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -278,7 +280,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testEmptyInsert() public function testEmptyInsert()
{ {
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
...@@ -303,13 +305,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -303,13 +305,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$types = array(\PDO::PARAM_INT); $types = array(\PDO::PARAM_INT);
$result = array(); $result = array();
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
->will($this->returnValue(new DriverConnectionMock())); ->will($this->returnValue(new DriverConnectionMock()));
$driverStatementMock = $this->getMock('Doctrine\Tests\Mocks\DriverStatementMock'); $driverStatementMock = $this->createMock('Doctrine\Tests\Mocks\DriverStatementMock');
$driverStatementMock->expects($this->once()) $driverStatementMock->expects($this->once())
->method('fetch') ->method('fetch')
...@@ -337,13 +339,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -337,13 +339,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$types = array(\PDO::PARAM_INT); $types = array(\PDO::PARAM_INT);
$result = array(); $result = array();
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
->will($this->returnValue(new DriverConnectionMock())); ->will($this->returnValue(new DriverConnectionMock()));
$driverStatementMock = $this->getMock('Doctrine\Tests\Mocks\DriverStatementMock'); $driverStatementMock = $this->createMock('Doctrine\Tests\Mocks\DriverStatementMock');
$driverStatementMock->expects($this->once()) $driverStatementMock->expects($this->once())
->method('fetch') ->method('fetch')
...@@ -372,13 +374,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -372,13 +374,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$column = 0; $column = 0;
$result = array(); $result = array();
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
->will($this->returnValue(new DriverConnectionMock())); ->will($this->returnValue(new DriverConnectionMock()));
$driverStatementMock = $this->getMock('Doctrine\Tests\Mocks\DriverStatementMock'); $driverStatementMock = $this->createMock('Doctrine\Tests\Mocks\DriverStatementMock');
$driverStatementMock->expects($this->once()) $driverStatementMock->expects($this->once())
->method('fetchColumn') ->method('fetchColumn')
...@@ -429,13 +431,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -429,13 +431,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$types = array(\PDO::PARAM_INT); $types = array(\PDO::PARAM_INT);
$result = array(); $result = array();
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$driverMock->expects($this->any()) $driverMock->expects($this->any())
->method('connect') ->method('connect')
->will($this->returnValue(new DriverConnectionMock())); ->will($this->returnValue(new DriverConnectionMock()));
$driverStatementMock = $this->getMock('Doctrine\Tests\Mocks\DriverStatementMock'); $driverStatementMock = $this->createMock('Doctrine\Tests\Mocks\DriverStatementMock');
$driverStatementMock->expects($this->once()) $driverStatementMock->expects($this->once())
->method('fetchAll') ->method('fetchAll')
...@@ -459,7 +461,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -459,7 +461,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{ {
$params['pdo'] = new \stdClass(); $params['pdo'] = new \stdClass();
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$conn = new Connection($params, $driverMock); $conn = new Connection($params, $driverMock);
...@@ -470,7 +472,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -470,7 +472,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{ {
$params['pdo'] = new \stdClass(); $params['pdo'] = new \stdClass();
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$conn = new Connection($params, $driverMock); $conn = new Connection($params, $driverMock);
...@@ -480,8 +482,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -480,8 +482,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testCallingDeleteWithNoDeletionCriteriaResultsInInvalidArgumentException() public function testCallingDeleteWithNoDeletionCriteriaResultsInInvalidArgumentException()
{ {
/* @var $driver \Doctrine\DBAL\Driver */ /* @var $driver \Doctrine\DBAL\Driver */
$driver = $this->getMock('Doctrine\DBAL\Driver'); $driver = $this->createMock('Doctrine\DBAL\Driver');
$pdoMock = $this->getMock('Doctrine\DBAL\Driver\Connection'); $pdoMock = $this->createMock('Doctrine\DBAL\Driver\Connection');
// should never execute queries with invalid arguments // should never execute queries with invalid arguments
$pdoMock->expects($this->never())->method('exec'); $pdoMock->expects($this->never())->method('exec');
...@@ -509,10 +511,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -509,10 +511,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/ */
public function testCallConnectOnce($method, $params) public function testCallConnectOnce($method, $params)
{ {
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$pdoMock = $this->getMock('Doctrine\DBAL\Driver\Connection'); $pdoMock = $this->createMock('Doctrine\DBAL\Driver\Connection');
$platformMock = new Mocks\MockPlatform(); $platformMock = new Mocks\MockPlatform();
$stmtMock = $this->getMock('Doctrine\DBAL\Driver\Statement'); $stmtMock = $this->createMock('Doctrine\DBAL\Driver\Statement');
$pdoMock->expects($this->any()) $pdoMock->expects($this->any())
->method('prepare') ->method('prepare')
...@@ -534,10 +536,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -534,10 +536,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform() public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform()
{ {
/** @var \Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock|\PHPUnit_Framework_MockObject_MockObject $driverMock */ /** @var \Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock|\PHPUnit_Framework_MockObject_MockObject $driverMock */
$driverMock = $this->getMock('Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock'); $driverMock = $this->createMock('Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock');
/** @var \Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock|\PHPUnit_Framework_MockObject_MockObject $driverConnectionMock */ /** @var \Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock|\PHPUnit_Framework_MockObject_MockObject $driverConnectionMock */
$driverConnectionMock = $this->getMock('Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock'); $driverConnectionMock = $this->createMock('Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock');
/** @var \Doctrine\DBAL\Platforms\AbstractPlatform|\PHPUnit_Framework_MockObject_MockObject $platformMock */ /** @var \Doctrine\DBAL\Platforms\AbstractPlatform|\PHPUnit_Framework_MockObject_MockObject $platformMock */
$platformMock = $this->getMockForAbstractClass('Doctrine\DBAL\Platforms\AbstractPlatform'); $platformMock = $this->getMockForAbstractClass('Doctrine\DBAL\Platforms\AbstractPlatform');
......
...@@ -9,15 +9,15 @@ class DBALExceptionTest extends \Doctrine\Tests\DbalTestCase ...@@ -9,15 +9,15 @@ class DBALExceptionTest extends \Doctrine\Tests\DbalTestCase
{ {
public function testDriverExceptionDuringQueryAcceptsBinaryData() public function testDriverExceptionDuringQueryAcceptsBinaryData()
{ {
$driver = $this->getMock('\Doctrine\DBAL\Driver'); $driver = $this->createMock('\Doctrine\DBAL\Driver');
$e = DBALException::driverExceptionDuringQuery($driver, new \Exception, '', array('ABC', chr(128))); $e = DBALException::driverExceptionDuringQuery($driver, new \Exception, '', array('ABC', chr(128)));
$this->assertContains('with params ["ABC", "\x80"]', $e->getMessage()); $this->assertContains('with params ["ABC", "\x80"]', $e->getMessage());
} }
public function testAvoidOverWrappingOnDriverException() public function testAvoidOverWrappingOnDriverException()
{ {
$driver = $this->getMock('\Doctrine\DBAL\Driver'); $driver = $this->createMock('\Doctrine\DBAL\Driver');
$ex = new DriverException('', $this->getMock('\Doctrine\DBAL\Driver\DriverException')); $ex = new DriverException('', $this->createMock('\Doctrine\DBAL\Driver\DriverException'));
$e = DBALException::driverExceptionDuringQuery($driver, $ex, ''); $e = DBALException::driverExceptionDuringQuery($driver, $ex, '');
$this->assertSame($ex, $e); $this->assertSame($ex, $e);
} }
......
...@@ -59,7 +59,7 @@ abstract class AbstractDriverTest extends DbalTestCase ...@@ -59,7 +59,7 @@ abstract class AbstractDriverTest extends DbalTestCase
); );
} }
$driverException = $this->getMock('Doctrine\DBAL\Driver\DriverException'); $driverException = $this->createMock('Doctrine\DBAL\Driver\DriverException');
$driverException->expects($this->any()) $driverException->expects($this->any())
->method('getErrorCode') ->method('getErrorCode')
...@@ -209,7 +209,7 @@ abstract class AbstractDriverTest extends DbalTestCase ...@@ -209,7 +209,7 @@ abstract class AbstractDriverTest extends DbalTestCase
foreach ($this->getExceptionConversionData() as $convertedExceptionClassName => $errors) { foreach ($this->getExceptionConversionData() as $convertedExceptionClassName => $errors) {
foreach ($errors as $error) { foreach ($errors as $error) {
$driverException = $this->getMock('Doctrine\DBAL\Driver\DriverException'); $driverException = $this->createMock('Doctrine\DBAL\Driver\DriverException');
$driverException->expects($this->any()) $driverException->expects($this->any())
->method('getErrorCode') ->method('getErrorCode')
......
...@@ -18,7 +18,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest ...@@ -18,7 +18,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
'password' => 'bar', 'password' => 'bar',
); );
$statement = $this->getMock('Doctrine\Tests\Mocks\DriverResultStatementMock'); $statement = $this->createMock('Doctrine\Tests\Mocks\DriverResultStatementMock');
$statement->expects($this->once()) $statement->expects($this->once())
->method('fetchColumn') ->method('fetchColumn')
......
...@@ -18,7 +18,7 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest ...@@ -18,7 +18,7 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
'password' => 'bar', 'password' => 'bar',
); );
$statement = $this->getMock('Doctrine\Tests\Mocks\DriverResultStatementMock'); $statement = $this->createMock('Doctrine\Tests\Mocks\DriverResultStatementMock');
$statement->expects($this->once()) $statement->expects($this->once())
->method('fetchColumn') ->method('fetchColumn')
......
...@@ -27,9 +27,10 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -27,9 +27,10 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase
*/ */
public function testExecute(array $params) public function testExecute(array $params)
{ {
$statement = $this->getMock('\Doctrine\DBAL\Driver\OCI8\OCI8Statement', $statement = $this->getMockBuilder('\Doctrine\DBAL\Driver\OCI8\OCI8Statement')
array('bindValue', 'errorInfo'), ->setMethods(array('bindValue', 'errorInfo'))
array(), '', false); ->disableOriginalConstructor()
->getMock();
$statement->expects($this->at(0)) $statement->expects($this->at(0))
->method('bindValue') ->method('bindValue')
...@@ -52,7 +53,10 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -52,7 +53,10 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase
// can't pass to constructor since we don't have a real database handle, // can't pass to constructor since we don't have a real database handle,
// but execute must check the connection for the executeMode // but execute must check the connection for the executeMode
$conn = $this->getMock('\Doctrine\DBAL\Driver\OCI8\OCI8Connection', array('getExecuteMode'), array(), '', false); $conn = $this->getMockBuilder('\Doctrine\DBAL\Driver\OCI8\OCI8Connection')
->setMethods(array('getExecuteMode'))
->disableOriginalConstructor()
->getMock();
$conn->expects($this->once()) $conn->expects($this->once())
->method('getExecuteMode'); ->method('getExecuteMode');
......
...@@ -11,7 +11,7 @@ class MysqlSessionInitTest extends DbalTestCase ...@@ -11,7 +11,7 @@ class MysqlSessionInitTest extends DbalTestCase
{ {
public function testPostConnect() public function testPostConnect()
{ {
$connectionMock = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false); $connectionMock = $this->createMock('Doctrine\DBAL\Connection');
$connectionMock->expects($this->once()) $connectionMock->expects($this->once())
->method('executeUpdate') ->method('executeUpdate')
->with($this->equalTo("SET NAMES foo COLLATE bar")); ->with($this->equalTo("SET NAMES foo COLLATE bar"));
...@@ -28,4 +28,4 @@ class MysqlSessionInitTest extends DbalTestCase ...@@ -28,4 +28,4 @@ class MysqlSessionInitTest extends DbalTestCase
$listener = new MysqlSessionInit(); $listener = new MysqlSessionInit();
$this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents()); $this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
} }
} }
\ No newline at end of file
...@@ -11,7 +11,7 @@ class OracleSessionInitTest extends DbalTestCase ...@@ -11,7 +11,7 @@ class OracleSessionInitTest extends DbalTestCase
{ {
public function testPostConnect() public function testPostConnect()
{ {
$connectionMock = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false); $connectionMock = $this->createMock('Doctrine\DBAL\Connection');
$connectionMock->expects($this->once()) $connectionMock->expects($this->once())
->method('executeUpdate') ->method('executeUpdate')
->with($this->isType('string')); ->with($this->isType('string'));
......
...@@ -14,7 +14,7 @@ class SQLSessionInitTest extends DbalTestCase ...@@ -14,7 +14,7 @@ class SQLSessionInitTest extends DbalTestCase
{ {
public function testPostConnect() public function testPostConnect()
{ {
$connectionMock = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false); $connectionMock = $this->createMock('Doctrine\DBAL\Connection');
$connectionMock->expects($this->once()) $connectionMock->expects($this->once())
->method('exec') ->method('exec')
->with($this->equalTo("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'")); ->with($this->equalTo("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'"));
...@@ -30,4 +30,4 @@ class SQLSessionInitTest extends DbalTestCase ...@@ -30,4 +30,4 @@ class SQLSessionInitTest extends DbalTestCase
$listener = new SQLSessionInit("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'"); $listener = new SQLSessionInit("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'");
$this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents()); $this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
} }
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -8,7 +8,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
{ {
$sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL(); $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
$logMock = $this->getMock('Doctrine\DBAL\Logging\SQLLogger'); $logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger');
$logMock->expects($this->at(0)) $logMock->expects($this->at(0))
->method('startQuery') ->method('startQuery')
->with($this->equalTo($sql), $this->equalTo(array()), $this->equalTo(array())); ->with($this->equalTo($sql), $this->equalTo(array()), $this->equalTo(array()));
...@@ -24,7 +24,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -24,7 +24,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL(); $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
$logMock = $this->getMock('Doctrine\DBAL\Logging\SQLLogger'); $logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger');
$logMock->expects($this->at(0)) $logMock->expects($this->at(0))
->method('startQuery') ->method('startQuery')
->with($this->equalTo($sql), $this->equalTo(array()), $this->equalTo(array())); ->with($this->equalTo($sql), $this->equalTo(array()), $this->equalTo(array()));
...@@ -38,7 +38,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -38,7 +38,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
{ {
$sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL(); $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
$logMock = $this->getMock('Doctrine\DBAL\Logging\SQLLogger'); $logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger');
$logMock->expects($this->once()) $logMock->expects($this->once())
->method('startQuery') ->method('startQuery')
->with($this->equalTo($sql), $this->equalTo(array())); ->with($this->equalTo($sql), $this->equalTo(array()));
...@@ -49,4 +49,4 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -49,4 +49,4 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $this->_conn->prepare($sql); $stmt = $this->_conn->prepare($sql);
$stmt->execute(); $stmt->execute();
} }
} }
\ No newline at end of file
...@@ -128,7 +128,9 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -128,7 +128,9 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
'portability' => $portability 'portability' => $portability
); );
$driverMock = $this->getMock('Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Driver', array('connect')); $driverMock = $this->getMockBuilder('Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Driver')
->setMethods(array('connect'))
->getMock();
$driverMock->expects($this->once()) $driverMock->expects($this->once())
->method('connect') ->method('connect')
......
...@@ -11,7 +11,7 @@ class DBAL461Test extends \PHPUnit_Framework_TestCase ...@@ -11,7 +11,7 @@ class DBAL461Test extends \PHPUnit_Framework_TestCase
{ {
public function testIssue() public function testIssue()
{ {
$conn = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false); $conn = $this->createMock('Doctrine\DBAL\Connection');
$platform = $this->getMockForAbstractClass('Doctrine\DBAL\Platforms\AbstractPlatform'); $platform = $this->getMockForAbstractClass('Doctrine\DBAL\Platforms\AbstractPlatform');
$platform->registerDoctrineTypeMapping('numeric', 'decimal'); $platform->registerDoctrineTypeMapping('numeric', 'decimal');
......
...@@ -318,7 +318,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -318,7 +318,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
public function testGetCreateTableSqlDispatchEvent() public function testGetCreateTableSqlDispatchEvent()
{ {
$listenerMock = $this->getMock('GetCreateTableSqlDispatchEvenListener', array('onSchemaCreateTable', 'onSchemaCreateTableColumn')); $listenerMock = $this->getMockBuilder('GetCreateTableSqlDispatchEvenListener')
->setMethods(array('onSchemaCreateTable', 'onSchemaCreateTableColumn'))
->getMock();
$listenerMock $listenerMock
->expects($this->once()) ->expects($this->once())
->method('onSchemaCreateTable'); ->method('onSchemaCreateTable');
...@@ -340,7 +342,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -340,7 +342,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
public function testGetDropTableSqlDispatchEvent() public function testGetDropTableSqlDispatchEvent()
{ {
$listenerMock = $this->getMock('GetDropTableSqlDispatchEventListener', array('onSchemaDropTable')); $listenerMock = $this->getMockBuilder('GetDropTableSqlDispatchEventListener')
->setMethods(array('onSchemaDropTable'))
->getMock();
$listenerMock $listenerMock
->expects($this->once()) ->expects($this->once())
->method('onSchemaDropTable'); ->method('onSchemaDropTable');
...@@ -363,7 +367,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -363,7 +367,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
'onSchemaAlterTableRenameColumn' 'onSchemaAlterTableRenameColumn'
); );
$listenerMock = $this->getMock('GetAlterTableSqlDispatchEvenListener', $events); $listenerMock = $this->getMockBuilder('GetAlterTableSqlDispatchEvenListener')
->setMethods($events)
->getMock();
$listenerMock $listenerMock
->expects($this->once()) ->expects($this->once())
->method('onSchemaAlterTable'); ->method('onSchemaAlterTable');
......
...@@ -456,7 +456,7 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase ...@@ -456,7 +456,7 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
{ {
$this->setExpectedException('\InvalidArgumentException'); $this->setExpectedException('\InvalidArgumentException');
$this->_platform->getCreateConstraintSQL($this->getMock('\Doctrine\DBAL\Schema\Constraint'), 'footable'); $this->_platform->getCreateConstraintSQL($this->createMock('\Doctrine\DBAL\Schema\Constraint'), 'footable');
} }
public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL()
......
...@@ -188,6 +188,6 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -188,6 +188,6 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
*/ */
protected function createWrappedStatement() protected function createWrappedStatement()
{ {
return $this->getMock('Doctrine\Tests\Mocks\DriverStatementMock'); return $this->createMock('Doctrine\Tests\Mocks\DriverStatementMock');
} }
} }
...@@ -14,7 +14,7 @@ class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase ...@@ -14,7 +14,7 @@ class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase
protected function setUp() protected function setUp()
{ {
$conn = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false); $conn = $this->createMock('Doctrine\DBAL\Connection');
$this->expr = new ExpressionBuilder($conn); $this->expr = new ExpressionBuilder($conn);
......
...@@ -14,7 +14,7 @@ class QueryBuilderTest extends \Doctrine\Tests\DbalTestCase ...@@ -14,7 +14,7 @@ class QueryBuilderTest extends \Doctrine\Tests\DbalTestCase
protected function setUp() protected function setUp()
{ {
$this->conn = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false); $this->conn = $this->createMock('Doctrine\DBAL\Connection');
$expressionBuilder = new ExpressionBuilder($this->conn); $expressionBuilder = new ExpressionBuilder($this->conn);
......
...@@ -1131,8 +1131,12 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase ...@@ -1131,8 +1131,12 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
public function testComparesNamespaces() public function testComparesNamespaces()
{ {
$comparator = new Comparator(); $comparator = new Comparator();
$fromSchema = $this->getMock('Doctrine\DBAL\Schema\Schema', array('getNamespaces', 'hasNamespace')); $fromSchema = $this->getMockBuilder('Doctrine\DBAL\Schema\Schema')
$toSchema = $this->getMock('Doctrine\DBAL\Schema\Schema', array('getNamespaces', 'hasNamespace')); ->setMethods(array('getNamespaces', 'hasNamespace'))
->getMock();
$toSchema = $this->getMockBuilder('Doctrine\DBAL\Schema\Schema')
->setMethods(array('getNamespaces', 'hasNamespace'))
->getMock();
$fromSchema->expects($this->once()) $fromSchema->expects($this->once())
->method('getNamespaces') ->method('getNamespaces')
......
...@@ -17,13 +17,12 @@ class MySqlSchemaManagerTest extends \PHPUnit_Framework_TestCase ...@@ -17,13 +17,12 @@ class MySqlSchemaManagerTest extends \PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
$eventManager = new EventManager(); $eventManager = new EventManager();
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$platform = $this->getMock('Doctrine\DBAL\Platforms\MySqlPlatform'); $platform = $this->createMock('Doctrine\DBAL\Platforms\MySqlPlatform');
$this->conn = $this->getMock( $this->conn = $this->getMockBuilder('Doctrine\DBAL\Connection')
'Doctrine\DBAL\Connection', ->setMethods(array('fetchAll'))
array('fetchAll'), ->setConstructorArgs(array(array('platform' => $platform), $driverMock, new Configuration(), $eventManager))
array(array('platform' => $platform), $driverMock, new Configuration(), $eventManager) ->getMock();
);
$this->manager = new MySqlSchemaManager($this->conn); $this->manager = new MySqlSchemaManager($this->conn);
} }
......
...@@ -20,13 +20,11 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase ...@@ -20,13 +20,11 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
$driverMock = $this->getMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$platform = $this->getMock('Doctrine\DBAL\Platforms\PostgreSqlPlatform'); $platform = $this->createMock('Doctrine\DBAL\Platforms\PostgreSqlPlatform');
$this->connection = $this->getMock( $this->connection = $this->getMockBuilder('Doctrine\DBAL\Connection')
'Doctrine\DBAL\Connection', ->setConstructorArgs(array(array('platform' => $platform), $driverMock))
array(), ->getMock();
array(array('platform' => $platform), $driverMock)
);
$this->schemaManager = new PostgreSqlSchemaManager($this->connection, $platform); $this->schemaManager = new PostgreSqlSchemaManager($this->connection, $platform);
} }
......
...@@ -35,7 +35,7 @@ class SchemaDiffTest extends \PHPUnit_Framework_TestCase ...@@ -35,7 +35,7 @@ class SchemaDiffTest extends \PHPUnit_Framework_TestCase
public function createPlatform($unsafe = false) public function createPlatform($unsafe = false)
{ {
$platform = $this->getMock('Doctrine\Tests\DBAL\Mocks\MockPlatform'); $platform = $this->createMock('Doctrine\Tests\DBAL\Mocks\MockPlatform');
$platform->expects($this->exactly(1)) $platform->expects($this->exactly(1))
->method('getCreateSchemaSQL') ->method('getCreateSchemaSQL')
->with('foo_ns') ->with('foo_ns')
......
...@@ -349,7 +349,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase ...@@ -349,7 +349,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
public function testVisitsVisitor() public function testVisitsVisitor()
{ {
$schema = new Schema(); $schema = new Schema();
$visitor = $this->getMock('Doctrine\DBAL\Schema\Visitor\Visitor'); $visitor = $this->createMock('Doctrine\DBAL\Schema\Visitor\Visitor');
$schema->createNamespace('foo'); $schema->createNamespace('foo');
$schema->createNamespace('bar'); $schema->createNamespace('bar');
...@@ -364,9 +364,6 @@ class SchemaTest extends \PHPUnit_Framework_TestCase ...@@ -364,9 +364,6 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
->method('acceptSchema') ->method('acceptSchema')
->with($schema); ->with($schema);
$visitor->expects($this->never())
->method('acceptNamespace');
$visitor->expects($this->at(1)) $visitor->expects($this->at(1))
->method('acceptTable') ->method('acceptTable')
->with($schema->getTable('baz')); ->with($schema->getTable('baz'));
...@@ -398,7 +395,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase ...@@ -398,7 +395,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
public function testVisitsNamespaceVisitor() public function testVisitsNamespaceVisitor()
{ {
$schema = new Schema(); $schema = new Schema();
$visitor = $this->getMock('Doctrine\DBAL\Schema\Visitor\AbstractVisitor'); $visitor = $this->createMock('Doctrine\DBAL\Schema\Visitor\AbstractVisitor');
$schema->createNamespace('foo'); $schema->createNamespace('foo');
$schema->createNamespace('bar'); $schema->createNamespace('bar');
......
...@@ -105,7 +105,7 @@ class CreateSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase ...@@ -105,7 +105,7 @@ class CreateSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
public function testResetsQueries() public function testResetsQueries()
{ {
foreach (array('supportsSchemas', 'supportsForeignKeys') as $method) { foreach (array('supportsSchemas', 'supportsForeignKeyConstraints') as $method) {
$this->platformMock->expects($this->any()) $this->platformMock->expects($this->any())
->method($method) ->method($method)
->will($this->returnValue(true)); ->will($this->returnValue(true));
......
...@@ -8,10 +8,9 @@ class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase ...@@ -8,10 +8,9 @@ class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
{ {
public function testCreateSchema() public function testCreateSchema()
{ {
$platformMock = $this->getMock( $platformMock = $this->getMockBuilder('Doctrine\DBAL\Platforms\MySqlPlatform')
'Doctrine\DBAL\Platforms\MySqlPlatform', ->setMethods(array('getCreateTableSql', 'getCreateSequenceSql', 'getCreateForeignKeySql'))
array('getCreateTableSql', 'getCreateSequenceSql', 'getCreateForeignKeySql') ->getMock();
);
$platformMock->expects($this->exactly(2)) $platformMock->expects($this->exactly(2))
->method('getCreateTableSql') ->method('getCreateTableSql')
->will($this->returnValue(array("foo"))); ->will($this->returnValue(array("foo")));
...@@ -31,10 +30,9 @@ class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase ...@@ -31,10 +30,9 @@ class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
public function testDropSchema() public function testDropSchema()
{ {
$platformMock = $this->getMock( $platformMock = $this->getMockBuilder('Doctrine\DBAL\Platforms\MySqlPlatform')
'Doctrine\DBAL\Platforms\MySqlPlatform', ->setMethods(array('getDropTableSql', 'getDropSequenceSql', 'getDropForeignKeySql'))
array('getDropTableSql', 'getDropSequenceSql', 'getDropForeignKeySql') ->getMock();
);
$platformMock->expects($this->exactly(2)) $platformMock->expects($this->exactly(2))
->method('getDropTableSql') ->method('getDropTableSql')
->will($this->returnValue("tbl")); ->will($this->returnValue("tbl"));
......
...@@ -24,12 +24,15 @@ class PoolingShardManagerTest extends \PHPUnit_Framework_TestCase ...@@ -24,12 +24,15 @@ class PoolingShardManagerTest extends \PHPUnit_Framework_TestCase
{ {
private function createConnectionMock() private function createConnectionMock()
{ {
return $this->getMock('Doctrine\DBAL\Sharding\PoolingShardConnection', array('connect', 'getParams', 'fetchAll'), array(), '', false); return $this->getMockBuilder('Doctrine\DBAL\Sharding\PoolingShardConnection')
->setMethods(array('connect', 'getParams', 'fetchAll'))
->disableOriginalConstructor()
->getMock();
} }
private function createPassthroughShardChoser() private function createPassthroughShardChoser()
{ {
$mock = $this->getMock('Doctrine\DBAL\Sharding\ShardChoser\ShardChoser'); $mock = $this->createMock('Doctrine\DBAL\Sharding\ShardChoser\ShardChoser');
$mock->expects($this->any()) $mock->expects($this->any())
->method('pickShard') ->method('pickShard')
->will($this->returnCallback(function($value) { return $value; })); ->will($this->returnCallback(function($value) { return $value; }));
...@@ -38,7 +41,7 @@ class PoolingShardManagerTest extends \PHPUnit_Framework_TestCase ...@@ -38,7 +41,7 @@ class PoolingShardManagerTest extends \PHPUnit_Framework_TestCase
private function createStaticShardChoser() private function createStaticShardChoser()
{ {
$mock = $this->getMock('Doctrine\DBAL\Sharding\ShardChoser\ShardChoser'); $mock = $this->createMock('Doctrine\DBAL\Sharding\ShardChoser\ShardChoser');
$mock->expects($this->any()) $mock->expects($this->any())
->method('pickShard') ->method('pickShard')
->will($this->returnCallback(function($value) { return 1; })); ->will($this->returnCallback(function($value) { return 1; }));
......
...@@ -85,7 +85,10 @@ class SQLAzureShardManagerTest extends \PHPUnit_Framework_TestCase ...@@ -85,7 +85,10 @@ class SQLAzureShardManagerTest extends \PHPUnit_Framework_TestCase
private function createConnection(array $params) private function createConnection(array $params)
{ {
$conn = $this->getMock('Doctrine\DBAL\Connection', array('getParams', 'exec', 'isTransactionActive'), array(), '', false); $conn = $this->getMockBuilder('Doctrine\DBAL\Connection')
->setMethods(array('getParams', 'exec', 'isTransactionActive'))
->disableOriginalConstructor()
->getMock();
$conn->expects($this->at(0))->method('getParams')->will($this->returnValue($params)); $conn->expects($this->at(0))->method('getParams')->will($this->returnValue($params));
return $conn; return $conn;
} }
......
...@@ -34,7 +34,10 @@ class MultiTenantShardChoserTest extends \PHPUnit_Framework_TestCase ...@@ -34,7 +34,10 @@ class MultiTenantShardChoserTest extends \PHPUnit_Framework_TestCase
private function createConnectionMock() private function createConnectionMock()
{ {
return $this->getMock('Doctrine\DBAL\Sharding\PoolingShardConnection', array('connect', 'getParams', 'fetchAll'), array(), '', false); return $this->getMockBuilder('Doctrine\DBAL\Sharding\PoolingShardConnection')
->setMethods(array('connect', 'getParams', 'fetchAll'))
->disableOriginalConstructor()
->getMock();
} }
} }
...@@ -8,13 +8,13 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -8,13 +8,13 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
{ {
/** /**
* *
* @var \Doctrine\DBAL\Connection * @var \Doctrine\DBAL\Connection
*/ */
private $conn; private $conn;
/** /**
* *
* @var \Doctrine\DBAL\Configuration * @var \Doctrine\DBAL\Configuration
*/ */
private $configuration; private $configuration;
...@@ -25,26 +25,30 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -25,26 +25,30 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
protected function setUp() protected function setUp()
{ {
$this->pdoStatement = $this->getMock('\PDOStatement', array('execute', 'bindParam', 'bindValue')); $this->pdoStatement = $this->getMockBuilder('\PDOStatement')
->setMethods(array('execute', 'bindParam', 'bindValue'))
->getMock();
$platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform(); $platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$driverConnection = $this->getMock('\Doctrine\DBAL\Driver\Connection'); $driverConnection = $this->createMock('\Doctrine\DBAL\Driver\Connection');
$driverConnection->expects($this->any()) $driverConnection->expects($this->any())
->method('prepare') ->method('prepare')
->will($this->returnValue($this->pdoStatement)); ->will($this->returnValue($this->pdoStatement));
$driver = $this->getMock('\Doctrine\DBAL\Driver'); $driver = $this->createMock('\Doctrine\DBAL\Driver');
$constructorArgs = array( $constructorArgs = array(
array( array(
'platform' => $platform 'platform' => $platform
), ),
$driver $driver
); );
$this->conn = $this->getMock('\Doctrine\DBAL\Connection', array(), $constructorArgs); $this->conn = $this->getMockBuilder('\Doctrine\DBAL\Connection')
->setConstructorArgs($constructorArgs)
->getMock();
$this->conn->expects($this->atLeastOnce()) $this->conn->expects($this->atLeastOnce())
->method('getWrappedConnection') ->method('getWrappedConnection')
->will($this->returnValue($driverConnection)); ->will($this->returnValue($driverConnection));
$this->configuration = $this->getMock('\Doctrine\DBAL\Configuration'); $this->configuration = $this->createMock('\Doctrine\DBAL\Configuration');
$this->conn->expects($this->any()) $this->conn->expects($this->any())
->method('getConfiguration') ->method('getConfiguration')
->will($this->returnValue($this->configuration)); ->will($this->returnValue($this->configuration));
...@@ -54,7 +58,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -54,7 +58,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
->will($this->returnValue($driver)); ->will($this->returnValue($driver));
} }
public function testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound() public function testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound()
{ {
$name = 'foo'; $name = 'foo';
...@@ -63,21 +67,21 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -63,21 +67,21 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$values = array($name => $var); $values = array($name => $var);
$types = array($name => $type); $types = array($name => $type);
$sql = ''; $sql = '';
$logger = $this->getMock('\Doctrine\DBAL\Logging\SQLLogger'); $logger = $this->createMock('\Doctrine\DBAL\Logging\SQLLogger');
$logger->expects($this->once()) $logger->expects($this->once())
->method('startQuery') ->method('startQuery')
->with($this->equalTo($sql), $this->equalTo($values), $this->equalTo($types)); ->with($this->equalTo($sql), $this->equalTo($values), $this->equalTo($types));
$this->configuration->expects($this->once()) $this->configuration->expects($this->once())
->method('getSQLLogger') ->method('getSQLLogger')
->will($this->returnValue($logger)); ->will($this->returnValue($logger));
$statement = new Statement($sql, $this->conn); $statement = new Statement($sql, $this->conn);
$statement->bindValue($name, $var, $type); $statement->bindValue($name, $var, $type);
$statement->execute(); $statement->execute();
} }
public function testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedToExecute() public function testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedToExecute()
{ {
$name = 'foo'; $name = 'foo';
...@@ -85,16 +89,16 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -85,16 +89,16 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$values = array($name => $var); $values = array($name => $var);
$types = array(); $types = array();
$sql = ''; $sql = '';
$logger = $this->getMock('\Doctrine\DBAL\Logging\SQLLogger'); $logger = $this->createMock('\Doctrine\DBAL\Logging\SQLLogger');
$logger->expects($this->once()) $logger->expects($this->once())
->method('startQuery') ->method('startQuery')
->with($this->equalTo($sql), $this->equalTo($values), $this->equalTo($types)); ->with($this->equalTo($sql), $this->equalTo($values), $this->equalTo($types));
$this->configuration->expects($this->once()) $this->configuration->expects($this->once())
->method('getSQLLogger') ->method('getSQLLogger')
->will($this->returnValue($logger)); ->will($this->returnValue($logger));
$statement = new Statement($sql, $this->conn); $statement = new Statement($sql, $this->conn);
$statement->execute($values); $statement->execute($values);
} }
...@@ -104,7 +108,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -104,7 +108,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
*/ */
public function testExecuteCallsLoggerStopQueryOnException() public function testExecuteCallsLoggerStopQueryOnException()
{ {
$logger = $this->getMock('\Doctrine\DBAL\Logging\SQLLogger'); $logger = $this->createMock('\Doctrine\DBAL\Logging\SQLLogger');
$this->configuration->expects($this->once()) $this->configuration->expects($this->once())
->method('getSQLLogger') ->method('getSQLLogger')
...@@ -128,4 +132,4 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -128,4 +132,4 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$statement = new Statement("", $this->conn); $statement = new Statement("", $this->conn);
$statement->execute(); $statement->execute();
} }
} }
\ No newline at end of file
...@@ -24,7 +24,7 @@ class RunSqlCommandTest extends \PHPUnit_Framework_TestCase ...@@ -24,7 +24,7 @@ class RunSqlCommandTest extends \PHPUnit_Framework_TestCase
$this->command = $application->find('dbal:run-sql'); $this->command = $application->find('dbal:run-sql');
$this->commandTester = new CommandTester($this->command); $this->commandTester = new CommandTester($this->command);
$this->connectionMock = $this->getMock('\Doctrine\DBAL\Connection', array(), array(), '', false); $this->connectionMock = $this->createMock('\Doctrine\DBAL\Connection');
$this->connectionMock->method('fetchAll') $this->connectionMock->method('fetchAll')
->willReturn(array(array(1))); ->willReturn(array(array(1)));
$this->connectionMock->method('executeUpdate') $this->connectionMock->method('executeUpdate')
......
...@@ -32,7 +32,7 @@ class GuidTest extends \Doctrine\Tests\DbalTestCase ...@@ -32,7 +32,7 @@ class GuidTest extends \Doctrine\Tests\DbalTestCase
{ {
$this->assertTrue($this->_type->requiresSQLCommentHint($this->_platform)); $this->assertTrue($this->_type->requiresSQLCommentHint($this->_platform));
$mock = $this->getMock(get_class($this->_platform)); $mock = $this->createMock(get_class($this->_platform));
$mock->expects($this->any()) $mock->expects($this->any())
->method('hasNativeGuidType') ->method('hasNativeGuidType')
->will($this->returnValue(true)); ->will($this->returnValue(true));
......
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