SqliteAnyTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the Stash package.
  4. *
  5. * (c) Robert Hafner <tedivm@tedivm.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Stash\Test\Driver;
  11. use Stash\Test\Stubs\PoolGetDriverStub;
  12. use Stash\Driver\Sqlite;
  13. use Stash\Item;
  14. use Stash\Pool;
  15. use Stash\Utilities;
  16. /**
  17. * @package Stash
  18. * @author Robert Hafner <tedivm@tedivm.com>
  19. */
  20. class SqliteAnyTest extends \PHPUnit_Framework_TestCase
  21. {
  22. protected $driverClass = 'Stash\Driver\Sqlite';
  23. protected function setUp()
  24. {
  25. $driverClass = $this->driverClass;
  26. if (!$driverClass::isAvailable()) {
  27. $this->markTestSkipped('Driver class unsuited for current environment');
  28. return;
  29. }
  30. }
  31. public function testConstruction()
  32. {
  33. $key = array('apple', 'sauce');
  34. $driver = new Sqlite(array());
  35. $pool = new Pool();
  36. $pool->setDriver($driver);
  37. $item = $pool->getItem('testKey');
  38. $item->set($key);
  39. $this->assertTrue($pool->save($item), 'Able to load and store with unconfigured extension.');
  40. }
  41. public static function tearDownAfterClass()
  42. {
  43. Utilities::deleteRecursive(Utilities::getBaseDirectory());
  44. }
  45. }