Skip to content

Commit

Permalink
Fix test in respect of expected exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Oct 30, 2020
1 parent 44f41ba commit 07326c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions tests/functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ private function setConnectionTimeout(\Doctrine\DBAL\Connection $connection, int

public function testExecuteQueryShouldNotReconnect(): void
{
$this->expectException(DBALException::class);

$connection = $this->createConnection(0);
$this->assertSame(1, $connection->connectCount);
$this->setConnectionTimeout($connection, 2);
sleep(3);

$this->expectException(DBALException::class);

$connection->executeQuery('SELECT 1');
}

Expand Down
8 changes: 3 additions & 5 deletions tests/unit/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ public function testConstructor(): void

public function testConstructorWithInvalidDriver(): void
{
$this->expectException(InvalidArgumentException::class);

$driver = $this->prophesize(Driver::class);
$configuration = $this->prophesize(Configuration::class);
$eventManager = $this->prophesize(EventManager::class);
Expand All @@ -84,14 +82,14 @@ public function testConstructorWithInvalidDriver(): void
'platform' => $platform->reveal()
];

$connection = new Connection(
$this->expectException(InvalidArgumentException::class);

new Connection(
$params,
$driver->reveal(),
$configuration->reveal(),
$eventManager->reveal()
);

static::assertInstanceOf(Connection::class, $connection);
}

/**
Expand Down

0 comments on commit 07326c1

Please sign in to comment.