From 5937851faca4d39d51e4fd74b956be46188de590 Mon Sep 17 00:00:00 2001 From: Chris Boden <cboden@gmail.com> Date: Wed, 17 Feb 2016 17:29:03 -0500 Subject: [PATCH] Skip PDO test if extension missing --- .../Storage/VirtualSessionStoragePDOTest.php | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/tests/unit/Session/Storage/VirtualSessionStoragePDOTest.php b/tests/unit/Session/Storage/VirtualSessionStoragePDOTest.php index 9909bce..2727484 100644 --- a/tests/unit/Session/Storage/VirtualSessionStoragePDOTest.php +++ b/tests/unit/Session/Storage/VirtualSessionStoragePDOTest.php @@ -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()); } - - }