You are here

public function CacheTest::testBasicCrudOperations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php \Doctrine\Tests\Common\Cache\CacheTest::testBasicCrudOperations()

@dataProvider provideCrudValues

File

vendor/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'));
}