PHP Classes

File: tests/InTransactionTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   EasyDB   tests/InTransactionTest.php   Download  
File: tests/InTransactionTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: EasyDB
Simple Database Abstraction Layer around PDO
Author: By
Last change: squishing error regarding default values
manually changing to squish "method name is not in camel caps format" style error
Date: 6 years ago
Size: 940 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

namespace
ParagonIE\EasyDB\Tests;

use
ParagonIE\EasyDB\Factory;

class
InTransactionTest extends EasyDBTest
{

   
/**
     * @param $dsn
     * @param string|null $username
     * @param string|null $password
     * @param array $options
     * @dataProvider goodFactoryCreateArgumentProvider
     */
   
public function testInTransaction(
       
$expectedDriver,
       
$dsn,
       
$username = null,
       
$password = null,
        array
$options = []
    ) {
       
$db = Factory::create($dsn, $username, $password, $options);
       
$this->assertFalse($db->inTransaction());
       
$db->beginTransaction();
       
$this->assertTrue($db->inTransaction());
       
$db->commit();
       
$this->assertFalse($db->inTransaction());
       
$db->beginTransaction();
       
$this->assertTrue($db->inTransaction());
       
$db->rollBack();
       
$this->assertFalse($db->inTransaction());
    }
}