Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix result cache and PDO connection test on pdo_sqlsrv #2650

Merged
merged 1 commit into from
Feb 9, 2017

Conversation

deeky666
Copy link
Member

@deeky666 deeky666 commented Feb 9, 2017

The story continues...

This fixes two test cases where pdo_sqlsrv fails.

ResultCacheTest

Exception: [Doctrine\DBAL\DBALException] An exception occurred while executing 'DELETE FROM caching':

SQLSTATE[HY010]: [unixODBC][Driver Manager]Function sequence error

Each test errors with that message. It is caused by the setUp() which tries to create the test table and silences exceptions. There seems to be a bug in the driver, that leaves the connection in an erroneous state when managing exceptions in userland: microsoft/msphpsql#49 (comment)

To make the tests pass for now, we correctly create the table on setup and drop it on teardown now.

PDOConnectionTest

1) Doctrine\Tests\DBAL\Functional\Driver\PDOConnectionTest::testThrowsWrappedExceptionOnPrepare
Failed asserting that exception of type "PDOException" matches expected exception "\Doctrine\DBAL\Driver\PDOException". Message was: "SQLSTATE[IMSSP]: The given attribute is only supported on the PDOStatement object." at
/php/srv/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php:69

pdo_sqlsrv for some reason only supports setting PDO::ATTR_EMULATE_PREPARES on the statement object but not on the connection object, which makes the test useless (so skipping that one).

// Emulated prepared statements have to be disabled for this test
// so that PDO actually communicates with the database server to check the query.
$this->driverConnection->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
//$this->driverConnection->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be commented out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, good catch! Thanks you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@Ocramius Ocramius added this to the 2.5.13 milestone Feb 9, 2017
@Ocramius Ocramius merged commit 0bd7781 into doctrine:master Feb 9, 2017
Ocramius added a commit that referenced this pull request Feb 9, 2017
@Ocramius
Copy link
Member

Ocramius commented Feb 9, 2017

Backported to 2.5 via 0c6eda3

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants