FileCacheTest.php 735B

1234567891011121314151617181920212223
  1. <?php
  2. namespace Metadata\Tests\Cache;
  3. use Metadata\ClassMetadata;
  4. use Metadata\Cache\FileCache;
  5. class FileCacheTest extends \PHPUnit_Framework_TestCase
  6. {
  7. public function testLoadEvictPutClassMetadataFromInCache()
  8. {
  9. $cache = new FileCache(sys_get_temp_dir());
  10. $this->assertNull($cache->loadClassMetadataFromCache($refl = new \ReflectionClass('Metadata\Tests\Fixtures\TestObject')));
  11. $cache->putClassMetadataInCache($metadata = new ClassMetadata('Metadata\Tests\Fixtures\TestObject'));
  12. $this->assertEquals($metadata, $cache->loadClassMetadataFromCache($refl));
  13. $cache->evictClassMetadataFromCache($refl);
  14. $this->assertNull($cache->loadClassMetadataFromCache($refl));
  15. }
  16. }