ion/tests/Cache/Driver/SQLDriverTest.php

45 lines
1.2 KiB
PHP
Raw Normal View History

2016-10-13 13:11:22 -04:00
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
2016-08-29 11:34:25 -04:00
namespace Aviat\Ion\Tests\Cache\Driver;
use Aviat\Ion\Config;
use Aviat\Ion\Friend;
use Aviat\Ion\Cache\Driver\SQLDriver;
2016-10-19 13:24:08 -04:00
use Aviat\Ion\Tests\Ion_TestCase;
2016-10-19 13:24:08 -04:00
class CacheSQLDriverTest extends Ion_TestCase {
use CacheDriverBase;
2016-08-29 11:34:25 -04:00
protected $driver;
2016-08-29 11:34:25 -04:00
public function setUp()
{
parent::setUp();
$this->driver = new SQLDriver($this->container->get('config'));
$friend = new Friend($this->driver);
$friend->db->query('CREATE TABLE IF NOT EXISTS "cache" ("key" TEXT NULL, "value" TEXT NULL, PRIMARY KEY ("key"))');
}
public function testMissingConfig()
{
$this->expectException('Aviat\Ion\Exception\ConfigException');
$this->expectExceptionMessage('Missing \'[cache]\' section in database config.');
$this->container->setInstance('config', new Config([]));
$this->driver = new SQLDriver($this->container->get('config'));
}
}