added test for tebus AT and P and added P
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Traits;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
trait DatabaseTransactions
|
||||
{
|
||||
/**
|
||||
* Database connections to use for transactions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $connections = ['mysql','mysql7'];
|
||||
|
||||
/**
|
||||
* Begin transactions on all specified database connections.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
foreach ($this->connections as $connection) {
|
||||
DB::connection($connection)->beginTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rollback transactions on all specified database connections.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
foreach ($this->connections as $connection) {
|
||||
DB::connection($connection)->rollBack();
|
||||
}
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the database connections for transactions.
|
||||
*
|
||||
* @param string|array $connections
|
||||
* @return void
|
||||
*/
|
||||
protected function setTransactionConnections(array $connections): void
|
||||
{
|
||||
$this->connections = $connections;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user