You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DoctrineProviderTest.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Cache\Tests;
  11. use Doctrine\Common\Cache\CacheProvider;
  12. use PHPUnit\Framework\TestCase;
  13. use Symfony\Component\Cache\Adapter\ArrayAdapter;
  14. use Symfony\Component\Cache\DoctrineProvider;
  15. class DoctrineProviderTest extends TestCase
  16. {
  17. public function testProvider()
  18. {
  19. $pool = new ArrayAdapter();
  20. $cache = new DoctrineProvider($pool);
  21. $this->assertInstanceOf(CacheProvider::class, $cache);
  22. $key = '{}()/\@:';
  23. $this->assertTrue($cache->delete($key));
  24. $this->assertFalse($cache->contains($key));
  25. $this->assertTrue($cache->save($key, 'bar'));
  26. $this->assertTrue($cache->contains($key));
  27. $this->assertSame('bar', $cache->fetch($key));
  28. $this->assertTrue($cache->delete($key));
  29. $this->assertFalse($cache->fetch($key));
  30. $this->assertTrue($cache->save($key, 'bar'));
  31. $cache->flushAll();
  32. $this->assertFalse($cache->fetch($key));
  33. $this->assertFalse($cache->contains($key));
  34. }
  35. }