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 @@
namespace Doctrine\Tests\DBAL;
use Doctrine\DBAL\Statement;
use Doctrine\DBAL\Logging\SQLLogger;
class StatementTest extends \Doctrine\Tests\DbalTestCase
{
/**
*
* @var \Doctrine\DBAL\Connection
* @var \Doctrine\DBAL\Connection
*/
private $conn;
/**
*
* @var \Doctrine\DBAL\Configuration
* @var \Doctrine\DBAL\Configuration
*/
private $configuration;
......@@ -32,7 +31,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$driverConnection->expects($this->any())
->method('prepare')
->will($this->returnValue($this->pdoStatement));
$driver = $this->getMock('\Doctrine\DBAL\Driver');
$constructorArgs = array(
array(
......@@ -44,7 +43,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$this->conn->expects($this->atLeastOnce())
->method('getWrappedConnection')
->will($this->returnValue($driverConnection));
$this->configuration = $this->getMock('\Doctrine\DBAL\Configuration');
$this->conn->expects($this->any())
->method('getConfiguration')
......@@ -55,7 +54,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
->will($this->returnValue($driver));
}
public function testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound()
{
$name = 'foo';
......@@ -64,21 +63,21 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$values = array($name => $var);
$types = array($name => $type);
$sql = '';
$logger = $this->getMock('\Doctrine\DBAL\Logging\SQLLogger');
$logger->expects($this->once())
->method('startQuery')
->with($this->equalTo($sql), $this->equalTo($values), $this->equalTo($types));
$this->configuration->expects($this->once())
->method('getSQLLogger')
->will($this->returnValue($logger));
$statement = new Statement($sql, $this->conn);
$statement->bindValue($name, $var, $type);
$statement->execute();
}
public function testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedToExecute()
{
$name = 'foo';
......@@ -86,16 +85,16 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$values = array($name => $var);
$types = array();
$sql = '';
$logger = $this->getMock('\Doctrine\DBAL\Logging\SQLLogger');
$logger->expects($this->once())
->method('startQuery')
->with($this->equalTo($sql), $this->equalTo($values), $this->equalTo($types));
$this->configuration->expects($this->once())
->method('getSQLLogger')
->will($this->returnValue($logger));
$statement = new Statement($sql, $this->conn);
$statement->execute($values);
}
......@@ -104,14 +103,14 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
{
$name = 'foo';
$var = 'bar';
$values = [$name => $var];
$types = [$name => \PDO::PARAM_STR];
$values = array($name => $var);
$types = array($name => \PDO::PARAM_STR);
$sql = '';
$logger = $this->createMock(SQLLogger::class);
$logger->expects(self::once())
$logger = $this->getMock('Doctrine\DBAL\Logging\SQLLogger');
$logger->expects($this->once())
->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())
->method('getSQLLogger')
......@@ -151,4 +150,4 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$statement = new Statement("", $this->conn);
$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