You are here

class MemcachedCacheTest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php \Doctrine\Tests\Common\Cache\MemcachedCacheTest

Hierarchy

  • class \Doctrine\Tests\Common\Cache\CacheTest extends \Doctrine\Tests\DoctrineTestCase

Expanded class hierarchy of MemcachedCacheTest

File

vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php, line 8

Namespace

Doctrine\Tests\Common\Cache
View source
class MemcachedCacheTest extends CacheTest {
  private $memcached;
  public function setUp() {
    if (!extension_loaded('memcached')) {
      $this
        ->markTestSkipped('The ' . __CLASS__ . ' requires the use of memcached');
    }
    $this->memcached = new Memcached();
    $this->memcached
      ->setOption(Memcached::OPT_COMPRESSION, false);
    $this->memcached
      ->addServer('127.0.0.1', 11211);
    if (@fsockopen('127.0.0.1', 11211) === false) {
      unset($this->memcached);
      $this
        ->markTestSkipped('The ' . __CLASS__ . ' cannot connect to memcache');
    }
  }
  public function tearDown() {
    if ($this->memcached instanceof Memcached) {
      $this->memcached
        ->flush();
    }
  }
  public function testNoExpire() {
    $cache = $this
      ->_getCacheDriver();
    $cache
      ->save('noexpire', 'value', 0);
    sleep(1);
    $this
      ->assertTrue($cache
      ->contains('noexpire'), 'Memcache provider should support no-expire');
  }
  public function testLongLifetime() {
    $cache = $this
      ->_getCacheDriver();
    $cache
      ->save('key', 'value', 30 * 24 * 3600 + 1);
    $this
      ->assertTrue($cache
      ->contains('key'), 'Memcache provider should support TTL > 30 days');
  }
  protected function _getCacheDriver() {
    $driver = new MemcachedCache();
    $driver
      ->setMemcached($this->memcached);
    return $driver;
  }

  /**
   * {@inheritDoc}
   *
   * @dataProvider falseCastedValuesProvider
   */
  public function testFalseCastedValues($value) {
    if (false === $value) {
      $this
        ->markTestIncomplete('Memcached currently doesn\'t support saving `false` values. ');
    }
    parent::testFalseCastedValues($value);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheTest::falseCastedValuesProvider public function The following values get converted to FALSE if you cast them to a boolean.
CacheTest::isSharedStorage protected function Return whether multiple cache providers share the same storage. 3
CacheTest::provideCrudValues public function
CacheTest::testBasicCrudOperations public function @dataProvider provideCrudValues
CacheTest::testCachedObject public function Check to see that objects are correctly serialized and unserialized by the cache provider. 1
CacheTest::testDeleteAll public function
CacheTest::testDeleteAllAndNamespaceVersioningBetweenCaches public function
CacheTest::testDeleteAllNamespace public function
CacheTest::testFetchMissShouldReturnFalse public function
CacheTest::testFetchMulti public function
CacheTest::testFetchMultipleObjects public function Check to see that objects fetched via fetchMultiple are properly unserialized 1
CacheTest::testFetchMultiWillFilterNonRequestedKeys public function
CacheTest::testFlushAll public function
CacheTest::testFlushAllAndNamespaceVersioningBetweenCaches public function
CacheTest::testGetStats public function @group DCOM-43 8
CacheTest::testNamespace public function
MemcachedCacheTest::$memcached private property
MemcachedCacheTest::setUp public function
MemcachedCacheTest::tearDown public function
MemcachedCacheTest::testFalseCastedValues public function @dataProvider falseCastedValuesProvider Overrides CacheTest::testFalseCastedValues
MemcachedCacheTest::testLongLifetime public function
MemcachedCacheTest::testNoExpire public function
MemcachedCacheTest::_getCacheDriver protected function Overrides CacheTest::_getCacheDriver