forked from doctrine/dbal
-
Notifications
You must be signed in to change notification settings - Fork 0
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 doctrine#3808 from morozov/remove-oci8-connection-…
…execute-mode Removed the OCI8Connection::getExecuteMode() method
- Loading branch information
Showing
5 changed files
with
90 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Driver\OCI8; | ||
|
||
/** | ||
* Encapsulates the execution mode that is shared between the connection and its statements. | ||
* | ||
* @internal This class is not covered by the backward compatibility promise | ||
*/ | ||
final class ExecutionMode | ||
{ | ||
/** @var bool */ | ||
private $isAutoCommitEnabled = true; | ||
|
||
public function enableAutoCommit() : void | ||
{ | ||
$this->isAutoCommitEnabled = true; | ||
} | ||
|
||
public function disableAutoCommit() : void | ||
{ | ||
$this->isAutoCommitEnabled = false; | ||
} | ||
|
||
public function isAutoCommitEnabled() : bool | ||
{ | ||
return $this->isAutoCommitEnabled; | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
tests/Doctrine/Tests/DBAL/Driver/OCI8/ExecutionModeTest.php
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\DBAL\Driver\OCI8; | ||
|
||
use Doctrine\DBAL\Driver\OCI8\ExecutionMode; | ||
use PHPStan\Testing\TestCase; | ||
|
||
final class ExecutionModeTest extends TestCase | ||
{ | ||
/** @var ExecutionMode */ | ||
private $mode; | ||
|
||
protected function setUp() : void | ||
{ | ||
$this->mode = new ExecutionMode(); | ||
} | ||
|
||
public function testDefaultAutoCommitStatus() : void | ||
{ | ||
self::assertTrue($this->mode->isAutoCommitEnabled()); | ||
} | ||
|
||
public function testChangeAutoCommitStatus() : void | ||
{ | ||
$this->mode->disableAutoCommit(); | ||
self::assertFalse($this->mode->isAutoCommitEnabled()); | ||
|
||
$this->mode->enableAutoCommit(); | ||
self::assertTrue($this->mode->isAutoCommitEnabled()); | ||
} | ||
} |