Commit bce4a363 authored by Steve Müller's avatar Steve Müller

make test compatible with 2.5 branch

parent cca70273
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
namespace Doctrine\Tests\DBAL; namespace Doctrine\Tests\DBAL;
use Doctrine\DBAL\Statement; use Doctrine\DBAL\Statement;
use Doctrine\DBAL\Logging\SQLLogger;
class StatementTest extends \Doctrine\Tests\DbalTestCase 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;
...@@ -32,7 +31,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -32,7 +31,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$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->getMock('\Doctrine\DBAL\Driver');
$constructorArgs = array( $constructorArgs = array(
array( array(
...@@ -44,7 +43,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -44,7 +43,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$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->getMock('\Doctrine\DBAL\Configuration');
$this->conn->expects($this->any()) $this->conn->expects($this->any())
->method('getConfiguration') ->method('getConfiguration')
...@@ -55,7 +54,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -55,7 +54,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';
...@@ -64,21 +63,21 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -64,21 +63,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->getMock('\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';
...@@ -86,16 +85,16 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -86,16 +85,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->getMock('\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,14 +103,14 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -104,14 +103,14 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
{ {
$name = 'foo'; $name = 'foo';
$var = 'bar'; $var = 'bar';
$values = [$name => $var]; $values = array($name => $var);
$types = [$name => \PDO::PARAM_STR]; $types = array($name => \PDO::PARAM_STR);
$sql = ''; $sql = '';
$logger = $this->createMock(SQLLogger::class); $logger = $this->getMock('Doctrine\DBAL\Logging\SQLLogger');
$logger->expects(self::once()) $logger->expects($this->once())
->method('startQuery') ->method('startQuery')
->with(self::equalTo($sql), self::equalTo($values), self::equalTo($types)); ->with($this->equalTo($sql), $this->equalTo($values), $this->equalTo($types));
$this->configuration->expects(self::once()) $this->configuration->expects(self::once())
->method('getSQLLogger') ->method('getSQLLogger')
...@@ -151,4 +150,4 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase ...@@ -151,4 +150,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
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