You are here

public function CacheTest::testBasicCrudOperations in Plug 7

@dataProvider provideCrudValues

File

lib/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php, line 13

Class

CacheTest

Namespace

Doctrine\Tests\Common\Cache

Code

public function testBasicCrudOperations($value) {
  $cache = $this
    ->_getCacheDriver();

  // Test saving a value, checking if it exists, and fetching it back
  $this
    ->assertTrue($cache
    ->save('key', 'value'));
  $this
    ->assertTrue($cache
    ->contains('key'));
  $this
    ->assertEquals('value', $cache
    ->fetch('key'));

  // Test updating the value of a cache entry
  $this
    ->assertTrue($cache
    ->save('key', 'value-changed'));
  $this
    ->assertTrue($cache
    ->contains('key'));
  $this
    ->assertEquals('value-changed', $cache
    ->fetch('key'));

  // Test deleting a value
  $this
    ->assertTrue($cache
    ->delete('key'));
  $this
    ->assertFalse($cache
    ->contains('key'));
}