Refactor Cache services

This commit is contained in:
Romain Neutron
2012-02-21 16:49:54 +01:00
parent 2c0a3f619f
commit c91a84937c
13 changed files with 484 additions and 25 deletions

View File

@@ -0,0 +1,49 @@
<?php
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for ApcCache.
* Generated by PHPUnit on 2012-02-21 at 16:39:56.
*/
class ApcCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ApcCache
*/
protected $object;
public function setUp()
{
$this->object = new \Alchemy\Phrasea\Cache\ApcCache;
}
public function testIsServer()
{
$this->assertTrue(is_bool($this->object->isServer()));
}
public function testGetStats()
{
$this->assertTrue(is_array($this->object->getStats()) || is_null($this->object->getStats()));
}
public function testGet()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
public function testDeleteMulti()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -0,0 +1,53 @@
<?php
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for ArrayCache.
* Generated by PHPUnit on 2012-02-21 at 16:37:10.
*/
class ArrayCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ArrayCache
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new \Alchemy\Phrasea\Cache\ArrayCache;
}
public function testIsServer()
{
$this->assertTrue(is_bool($this->object->isServer()));
}
public function testGetStats()
{
$this->assertTrue(is_array($this->object->getStats()) || is_null($this->object->getStats()));
}
public function testGet()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
public function testDeleteMulti()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -0,0 +1,51 @@
<?php
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for Manager.
* Generated by PHPUnit on 2012-02-21 at 16:37:11.
*/
class ManagerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Manager
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new \Alchemy\Phrasea\Cache\Manager;
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testFlushAll().
*/
public function testFlushAll()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet().
*/
public function testGet()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -0,0 +1,66 @@
<?php
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for MemcacheCache.
* Generated by PHPUnit on 2012-02-21 at 16:37:11.
*/
class MemcacheCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var MemcacheCache
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new \Alchemy\Phrasea\Cache\MemcacheCache;
if(!class_exists('Memcache'))
{
$this->markTestSkipped('No memcache extension');
}
$memcache = new Memcache();
if(!@$memcache->connect('localhost', 11211))
{
$this->markTestSkipped('No memcache server');
}
$this->object->setMemcache($memcache);
}
public function testIsServer()
{
$this->assertTrue(is_bool($this->object->isServer()));
}
public function testGetStats()
{
$this->assertTrue(is_array($this->object->getStats()) || is_null($this->object->getStats()));
}
public function testGet()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
public function testDeleteMulti()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -0,0 +1,53 @@
<?php
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for XcacheCache.
* Generated by PHPUnit on 2012-02-21 at 16:39:57.
*/
class XcacheCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var XcacheCache
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new \Alchemy\Phrasea\Cache\XcacheCache;
}
public function testIsServer()
{
$this->assertTrue(is_bool($this->object->isServer()));
}
public function testGetStats()
{
$this->assertTrue(is_array($this->object->getStats()) || is_null($this->object->getStats()));
}
public function testGet()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
public function testDeleteMulti()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}