Skip to content

Commit

Permalink
#714 - prepares should be disabled by default, but skipped when defin…
Browse files Browse the repository at this point in the history
…ed and not set to `true`
  • Loading branch information
Ocramius committed Nov 7, 2014
1 parent a576a3a commit f11e14c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,44 @@ public function testConnectionDisablesPreparesOnPhp56()
$this->assertTrue($connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
}

public function testConnectionDoesNotDisablePreparesOnPhp56WhenAttributeDefined()
{
$this->skipWhenNotUsingPhp56AndPdoPgsql();

$connection = $this->createDriver()->connect(
array(
'host' => $GLOBALS['db_host'],
'dbname' => $GLOBALS['db_name'],
'port' => $GLOBALS['db_port']
),
$GLOBALS['db_username'],
$GLOBALS['db_password'],
array(PDO::PGSQL_ATTR_DISABLE_PREPARES => false)
);

$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
$this->assertNotSame(true, $connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
}

public function testConnectionDisablePreparesOnPhp56WhenDisablePreparesIsExplicitlyDefined()
{
$this->skipWhenNotUsingPhp56AndPdoPgsql();

$connection = $this->createDriver()->connect(
array(
'host' => $GLOBALS['db_host'],
'dbname' => $GLOBALS['db_name'],
'port' => $GLOBALS['db_port']
),
$GLOBALS['db_username'],
$GLOBALS['db_password'],
array(PDO::PGSQL_ATTR_DISABLE_PREPARES => true)
);

$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
$this->assertTrue($connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
}

/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit f11e14c

Please sign in to comment.