Skip to content
This repository has been archived by the owner on Mar 27, 2022. It is now read-only.

Commit

Permalink
Work around HHVM failure
Browse files Browse the repository at this point in the history
  • Loading branch information
DASPRiD committed Feb 22, 2016
1 parent 0eb145d commit cfed450
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions test/ConnectionFactoryTest.php
Expand Up @@ -39,28 +39,19 @@ public function setUp()

public function testDefaultsThroughException()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM is somewhat funky here');
}

$factory = new ConnectionFactory();

// This is actually quite tricky. We cannot really test the pure defaults, as that would require a MySQL
// connection without a username and password. Since that can't work, we just verify that we get an exception
// with the right backtrace, and test the other defaults with a pure memory-database later.

try {
$connection = $factory($this->prophesize(ContainerInterface::class)->reveal());

// Oh, this tricky little HHVM bitch, doesn't try to connect till we do something with the connection!
$connection->connect();
$factory($this->prophesize(ContainerInterface::class)->reveal());
} catch (ConnectionException $e) {
$expectedUsername = '';

if (defined('HHVM_VERSION')) {
$expectedUsername = posix_getpwuid(posix_geteuid())['name'];
}

$this->assertContains(sprintf(
"Access denied for user '%s'@'localhost' (using password: NO)",
$expectedUsername
), $e->getMessage());
$this->assertContains("Access denied for user ''@'localhost' (using password: NO)", $e->getMessage());

foreach ($e->getTrace() as $entry) {
if ('Doctrine\DBAL\Driver\PDOMySql\Driver' === $entry['class']) {
Expand Down

0 comments on commit cfed450

Please sign in to comment.