Fully cover SQL cache driver with tests

This commit is contained in:
Timothy Warren 2016-08-29 12:57:16 -04:00
parent 3db58c7066
commit 1050bee698

View File

@ -2,6 +2,7 @@
namespace Aviat\Ion\Tests\Cache\Driver; namespace Aviat\Ion\Tests\Cache\Driver;
use Aviat\Ion\Config;
use Aviat\Ion\Friend; use Aviat\Ion\Friend;
use Aviat\Ion\Cache\Driver\SQLDriver; use Aviat\Ion\Cache\Driver\SQLDriver;
@ -17,4 +18,13 @@ class CacheSQLDriverTest extends \Ion_TestCase {
$friend = new Friend($this->driver); $friend = new Friend($this->driver);
$friend->db->query('CREATE TABLE IF NOT EXISTS "cache" ("key" TEXT NULL, "value" TEXT NULL, PRIMARY KEY ("key"))'); $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'));
}
} }