VoidCacheTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Doctrine\Tests\Common\Cache;
  3. use Doctrine\Common\Cache\VoidCache;
  4. /**
  5. * @covers \Doctrine\Common\Cache\VoidCache
  6. */
  7. class VoidCacheTest extends \PHPUnit_Framework_TestCase
  8. {
  9. public function testShouldAlwaysReturnFalseOnContains()
  10. {
  11. $cache = new VoidCache();
  12. $this->assertFalse($cache->contains('foo'));
  13. $this->assertFalse($cache->contains('bar'));
  14. }
  15. public function testShouldAlwaysReturnFalseOnFetch()
  16. {
  17. $cache = new VoidCache();
  18. $this->assertFalse($cache->fetch('foo'));
  19. $this->assertFalse($cache->fetch('bar'));
  20. }
  21. public function testShouldAlwaysReturnTrueOnSaveButNotStoreAnything()
  22. {
  23. $cache = new VoidCache();
  24. $this->assertTrue($cache->save('foo', 'fooVal'));
  25. $this->assertFalse($cache->contains('foo'));
  26. $this->assertFalse($cache->fetch('foo'));
  27. }
  28. public function testShouldAlwaysReturnTrueOnDelete()
  29. {
  30. $cache = new VoidCache();
  31. $this->assertTrue($cache->delete('foo'));
  32. }
  33. public function testShouldAlwaysReturnNullOnGetStatus()
  34. {
  35. $cache = new VoidCache();
  36. $this->assertNull($cache->getStats());
  37. }
  38. }