1
0
mirror of synced 2025-01-31 12:32:59 +03:00

Fix test failing when memcache extension is installed, but memcache server isnt.

This commit is contained in:
Benjamin Eberlei 2013-02-13 08:46:37 +01:00
parent 719031f2ef
commit 3d9cb9460a

View File

@ -15,7 +15,7 @@ class DDC742Test extends \Doctrine\Tests\OrmFunctionalTestCase
{ {
parent::setUp(); parent::setUp();
if (\extension_loaded('memcache')) { if (\extension_loaded('memcache') && @fsockopen('localhost', 11211)) {
$memcache = new \Memcache(); $memcache = new \Memcache();
$memcache->addServer('localhost'); $memcache->addServer('localhost');
$memcache->flush(); $memcache->flush();
@ -26,6 +26,8 @@ class DDC742Test extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->getMetadataFactory()->setCacheDriver($cacheDriver); $this->_em->getMetadataFactory()->setCacheDriver($cacheDriver);
} else if (\extension_loaded('apc')) { } else if (\extension_loaded('apc')) {
$this->_em->getMetadataFactory()->setCacheDriver(new \Doctrine\Common\Cache\ApcCache()); $this->_em->getMetadataFactory()->setCacheDriver(new \Doctrine\Common\Cache\ApcCache());
} else {
$this->markTestSkipped('Test only works with a cache enabled.');
} }
try { try {