-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Catch Throwable in Connection::transactional() #2390
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,11 +196,30 @@ public function testTransactionalWithException() | |
$conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL()); | ||
throw new \RuntimeException("Ooops!"); | ||
}); | ||
$this->fail('Expected exception'); | ||
} catch (\RuntimeException $expected) { | ||
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel()); | ||
} | ||
} | ||
|
||
public function testTransactionalWithThrowable() | ||
{ | ||
if (version_compare(PHP_VERSION, '7.0', '<')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about the convention for skipping tests in older php versions. If this is not good I can change it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Ocramius thanks, updated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fprochazka did you push? I still see the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I did, and it failed hard #2390 (diff) |
||
$this->markTestSkipped('Only for PHP 7.0 and above.'); | ||
} | ||
|
||
try { | ||
$this->_conn->transactional(function($conn) { | ||
/* @var $conn \Doctrine\DBAL\Connection */ | ||
$conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL()); | ||
throw new \Error("Ooops!"); | ||
}); | ||
$this->fail('Expected exception'); | ||
} catch (\Error $expected) { | ||
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel()); | ||
} | ||
} | ||
|
||
public function testTransactional() | ||
{ | ||
$this->_conn->transactional(function($conn) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this because it was incosistent in this file (didn't look at the other files tho).