class MongoDBCacheTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php \Doctrine\Tests\Common\Cache\MongoDBCacheTest
Hierarchy
- class \Doctrine\Tests\Common\Cache\CacheTest extends \Doctrine\Tests\DoctrineTestCase- class \Doctrine\Tests\Common\Cache\MongoDBCacheTest
 
Expanded class hierarchy of MongoDBCacheTest
File
- vendor/doctrine/ cache/ tests/ Doctrine/ Tests/ Common/ Cache/ MongoDBCacheTest.php, line 10 
Namespace
Doctrine\Tests\Common\CacheView source
class MongoDBCacheTest extends CacheTest {
  /**
   * @var MongoCollection
   */
  private $collection;
  public function setUp() {
    if (!version_compare(phpversion('mongo'), '1.3.0', '>=')) {
      $this
        ->markTestSkipped('The ' . __CLASS__ . ' requires the use of mongo >= 1.3.0');
    }
    $mongo = new MongoClient();
    $this->collection = $mongo
      ->selectCollection('doctrine_common_cache', 'test');
  }
  public function tearDown() {
    if ($this->collection instanceof MongoCollection) {
      $this->collection
        ->drop();
    }
  }
  public function testSaveWithNonUtf8String() {
    // Invalid 2-octet sequence
    $data = "";
    $cache = $this
      ->_getCacheDriver();
    $this
      ->assertTrue($cache
      ->save('key', $data));
    $this
      ->assertEquals($data, $cache
      ->fetch('key'));
  }
  public function testGetStats() {
    $cache = $this
      ->_getCacheDriver();
    $stats = $cache
      ->getStats();
    $this
      ->assertNull($stats[Cache::STATS_HITS]);
    $this
      ->assertNull($stats[Cache::STATS_MISSES]);
    $this
      ->assertGreaterThan(0, $stats[Cache::STATS_UPTIME]);
    $this
      ->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]);
    $this
      ->assertNull($stats[Cache::STATS_MEMORY_AVAILABLE]);
  }
  protected function _getCacheDriver() {
    return new MongoDBCache($this->collection);
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| CacheTest:: | public | function | The following values get converted to FALSE if you cast them to a boolean. | |
| CacheTest:: | protected | function | Return whether multiple cache providers share the same storage. | 3 | 
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | @dataProvider provideCrudValues | |
| CacheTest:: | public | function | Check to see that objects are correctly serialized and unserialized by the cache provider. | 1 | 
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | Check to see that, even if the user saves a value that can be interpreted as false, the cache adapter will still recognize its existence there. | 2 | 
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | Check to see that objects fetched via fetchMultiple are properly unserialized | 1 | 
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | ||
| CacheTest:: | public | function | ||
| MongoDBCacheTest:: | private | property | ||
| MongoDBCacheTest:: | public | function | ||
| MongoDBCacheTest:: | public | function | ||
| MongoDBCacheTest:: | public | function | @group DCOM-43 Overrides CacheTest:: | |
| MongoDBCacheTest:: | public | function | ||
| MongoDBCacheTest:: | protected | function | Overrides CacheTest:: | 
