NoopCacheTests.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. use League\Flysystem\Cached\Storage\Noop;
  3. use PHPUnit\Framework\TestCase;
  4. class NoopCacheTests extends TestCase
  5. {
  6. public function testNoop()
  7. {
  8. $cache = new Noop();
  9. $this->assertEquals($cache, $cache->storeMiss('file.txt'));
  10. $this->assertNull($cache->setComplete('', false));
  11. $this->assertNull($cache->load());
  12. $this->assertNull($cache->flush());
  13. $this->assertNull($cache->has('path.txt'));
  14. $this->assertNull($cache->autosave());
  15. $this->assertFalse($cache->isComplete('', false));
  16. $this->assertFalse($cache->read('something'));
  17. $this->assertFalse($cache->readStream('something'));
  18. $this->assertFalse($cache->getMetadata('something'));
  19. $this->assertFalse($cache->getMimetype('something'));
  20. $this->assertFalse($cache->getSize('something'));
  21. $this->assertFalse($cache->getTimestamp('something'));
  22. $this->assertFalse($cache->getVisibility('something'));
  23. $this->assertEmpty($cache->listContents('', false));
  24. $this->assertFalse($cache->rename('', ''));
  25. $this->assertFalse($cache->copy('', ''));
  26. $this->assertNull($cache->save());
  27. $object = ['path' => 'path.ext'];
  28. $this->assertEquals($object, $cache->updateObject('path.txt', $object));
  29. $this->assertEquals([['path' => 'some/file.txt']], $cache->storeContents('unknwon', [
  30. ['path' => 'some/file.txt'],
  31. ], false));
  32. }
  33. }