PHP Classes
elePHPant
Icontem

File: tests/GetAvailableDriversTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  EasyDB  >  tests/GetAvailableDriversTest.php  >  Download  
File: tests/GetAvailableDriversTest.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
single-lining test classes after composer run fix-style
running composer run fix-style
Date: 1 year ago
Size: 1,563 bytes
 

Contents

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

namespace
ParagonIE\EasyDB\Tests;

use
ParagonIE\EasyDB\Factory;
use
PDO;

class
GetAvailableDriversTest extends EasyDBTest
{

   
/**
     * @param $dsn
     * @param null $username
     * @param null $password
     * @param array $options
     * @dataProvider goodFactoryCreateArgumentProvider
     */
   
public function testGetAvailableDrivers(
       
$expectedDriver,
       
$dsn,
       
$username = null,
       
$password = null,
        array
$options = []
    ) {
        if (
count(PDO::getAvailableDrivers()) < 1) {
           
$this->markTestSkipped('No drivers available!');
        } else {
           
$db = Factory::create($dsn, $username, $password, $options);
           
$this->assertEquals(
               
count(
                   
array_diff_assoc(
                       
PDO::getAvailableDrivers(),
                       
$db->getAvailableDrivers()
                    )
                ),
               
0
           
);
           
$this->assertEquals(
               
count(
                   
array_diff_assoc(
                       
PDO::getAvailableDrivers(),
                       
$db->getPdo()->getAvailableDrivers()
                    )
                ),
               
0
           
);
           
$this->assertEquals(
               
count(
                   
array_diff_assoc(
                       
$db->getAvailableDrivers(),
                       
$db->getPdo()->getAvailableDrivers()
                    )
                ),
               
0
           
);
        }
    }
}