Skip PDO test if extension missing

This commit is contained in:
Chris Boden 2016-02-17 17:29:03 -05:00
parent 5ad0feface
commit 5937851fac

View File

@ -1,15 +1,11 @@
<?php
namespace Ratchet\Session\Storage;
use Ratchet\Session\Serialize\PhpHandler;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
class VirtualSessionStoragePDOTest extends \PHPUnit_Framework_TestCase
{
class VirtualSessionStoragePDOTest extends \PHPUnit_Framework_TestCase {
/**
* @var VirtualSessionStorage
*/
@ -17,8 +13,11 @@ class VirtualSessionStoragePDOTest extends \PHPUnit_Framework_TestCase
protected $_pathToDB;
public function setUp()
{
public function setUp() {
if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) {
return $this->markTestSkipped('Session test requires PDO and pdo_sqlite');
}
$schema = <<<SQL
CREATE TABLE `sessions` (
`sess_id` VARBINARY(128) NOT NULL PRIMARY KEY,
@ -42,17 +41,13 @@ SQL;
$this->_virtualSessionStorage->registerBag(new AttributeBag());
}
public function tearDown()
{
public function tearDown() {
unlink($this->_pathToDB);
}
public function testStartWithDSN()
{
public function testStartWithDSN() {
$this->_virtualSessionStorage->start();
$this->assertTrue($this->_virtualSessionStorage->isStarted());
}
}