Query/tests/CoreTest.php

71 lines
1.4 KiB
PHP
Raw Normal View History

2016-10-12 22:12:25 -04:00
<?php declare(strict_types=1);
/**
2016-10-12 22:12:25 -04:00
* Query
*
2016-10-12 22:12:25 -04:00
* SQL Query Builder / Database Abstraction Layer
*
2018-01-19 16:50:34 -05:00
* PHP version 7.1
2016-10-12 22:12:25 -04:00
*
* @package Query
* @author Timothy J. Warren <tim@timshomepage.net>
2018-01-19 16:50:34 -05:00
* @copyright 2012 - 2018 Timothy J. Warren
2016-10-12 22:12:25 -04:00
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query
*/
namespace Query\Tests;
/**
* CoreTest class - Compatibility and core functionality tests
2014-02-19 13:45:05 -05:00
*
* @extends UnitTestCase
*/
class CoreTest extends TestCase {
2014-02-19 13:45:05 -05:00
/**
* TestPHPVersion function.
2014-02-19 13:45:05 -05:00
*
* @access public
* @return void
*/
public function testPHPVersion(): void
{
//$this->assertTrue(version_compare(PHP_VERSION, '7.1', 'ge'));
$this->assertTrue(PHP_VERSION_ID >= 70000);
}
2014-02-19 13:45:05 -05:00
/**
* TestHasPDO function.
2014-02-19 13:45:05 -05:00
*
* @access public
* @return void
*/
public function testHasPDO(): void
{
// PDO class exists
$this->assertTrue(class_exists('PDO'));
2014-02-19 13:45:05 -05:00
// Make sure at least one of the supported drivers is enabled
$supported = [
'mysql',
'pgsql',
'sqlite',
];
2014-02-19 13:45:05 -05:00
$drivers = \PDO::getAvailableDrivers();
2014-02-19 13:45:05 -05:00
2016-10-13 21:55:23 -04:00
$numSupported = count(array_intersect($drivers, $supported));
2014-02-19 13:45:05 -05:00
2016-10-13 21:55:23 -04:00
$this->assertTrue($numSupported > 0);
}
2018-01-24 13:14:03 -05:00
public function testNullQuery(): void
{
$this->assertNull(\Query(NULL));
}
public function testEmptyRegexInArray(): void
{
$this->assertFalse(\regexInArray([], 'foo'));
}
}