-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
170 additions
and
81 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,44 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Amp\Postgres\Test; | ||
|
||
use Amp\Postgres\PgSqlConnection; | ||
use Amp\Postgres\PostgresConfig; | ||
use Amp\Postgres\PostgresLink; | ||
use Amp\Postgres\PostgresNestableTransaction; | ||
use Amp\Postgres\PostgresTransaction; | ||
|
||
/** | ||
* @requires extension pgsql | ||
*/ | ||
class PgSqlNestedTransactionTest extends AbstractLinkTest | ||
{ | ||
protected PgSqlConnection $connection; | ||
protected PostgresTransaction $transaction; | ||
|
||
public function createLink(string $connectionString): PostgresLink | ||
{ | ||
$connectionConfig = PostgresConfig::fromString($connectionString); | ||
$connection = PgSqlConnection::connect($connectionConfig); | ||
|
||
$connection->query(self::DROP_QUERY); | ||
|
||
$connection->query(self::CREATE_QUERY); | ||
|
||
foreach ($this->getParams() as $row) { | ||
$connection->execute(self::INSERT_QUERY, $row); | ||
} | ||
|
||
$this->connection = $connection; | ||
$this->transaction = $connection->beginTransaction(); | ||
|
||
return new PostgresNestableTransaction($this->transaction); | ||
} | ||
|
||
public function tearDown(): void | ||
{ | ||
$this->transaction->rollback(); | ||
|
||
parent::tearDown(); | ||
} | ||
} |
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,42 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Amp\Postgres\Test; | ||
|
||
use Amp\Postgres\PostgresConfig; | ||
use Amp\Postgres\PostgresLink; | ||
use Amp\Postgres\PostgresNestableTransaction; | ||
use Amp\Postgres\PostgresTransaction; | ||
use Amp\Postgres\PqConnection; | ||
|
||
/** | ||
* @requires extension pgsql | ||
*/ | ||
class PqNestedTransactionTest extends AbstractLinkTest | ||
{ | ||
protected PostgresTransaction $transaction; | ||
|
||
public function createLink(string $connectionString): PostgresLink | ||
{ | ||
$connectionConfig = PostgresConfig::fromString($connectionString); | ||
$connection = PqConnection::connect($connectionConfig); | ||
|
||
$connection->query(self::DROP_QUERY); | ||
|
||
$connection->query(self::CREATE_QUERY); | ||
|
||
foreach ($this->getParams() as $row) { | ||
$connection->execute(self::INSERT_QUERY, $row); | ||
} | ||
|
||
$this->transaction = $connection->beginTransaction(); | ||
|
||
return new PostgresNestableTransaction($this->transaction); | ||
} | ||
|
||
public function tearDown(): void | ||
{ | ||
//$this->transaction->rollback(); | ||
|
||
parent::tearDown(); | ||
} | ||
} |
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