-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3588 from petitpress/add_commit_return
Add commit result bool
- Loading branch information
Showing
4 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\DBAL\Functional; | ||
|
||
use Doctrine\DBAL\Platforms\MySqlPlatform; | ||
use Doctrine\Tests\DbalFunctionalTestCase; | ||
use function sleep; | ||
|
||
class TransactionTest extends DbalFunctionalTestCase | ||
{ | ||
protected function setUp() : void | ||
{ | ||
parent::setUp(); | ||
|
||
if ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) { | ||
return; | ||
} | ||
|
||
$this->markTestSkipped('Restricted to MySQL.'); | ||
} | ||
|
||
protected function tearDown() : void | ||
{ | ||
$this->resetSharedConn(); | ||
|
||
parent::tearDown(); | ||
} | ||
|
||
public function testCommitFalse() : void | ||
{ | ||
$this->connection->query('SET SESSION wait_timeout=1'); | ||
|
||
$this->assertTrue($this->connection->beginTransaction()); | ||
|
||
sleep(2); // during the sleep mysql will close the connection | ||
|
||
$this->assertFalse(@$this->connection->commit()); // we will ignore `MySQL server has gone away` warnings | ||
} | ||
} |