SafeLocalSpec.php 843 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace spec\Gaufrette\Adapter;
  3. use org\bovigo\vfs\vfsStream;
  4. use PhpSpec\ObjectBehavior;
  5. class SafeLocalSpec extends ObjectBehavior
  6. {
  7. function let()
  8. {
  9. vfsStream::setup('test');
  10. vfsStream::copyFromFileSystem(__DIR__.'/MockFilesystem');
  11. $this->beConstructedWith(vfsStream::url('test'));
  12. }
  13. function it_is_local_adapter()
  14. {
  15. $this->shouldHaveType('Gaufrette\Adapter\Local');
  16. }
  17. function it_computes_path_using_base64()
  18. {
  19. rename(vfsStream::url('test/filename'), vfsStream::url('test/'.base64_encode('filename')));
  20. $this->read('filename')->shouldReturn("content\n");
  21. }
  22. function it_computes_key_back_using_base64()
  23. {
  24. $this->keys()->shouldReturn(array(base64_decode('dir'), base64_decode('dir/file'), base64_decode('filename')));
  25. }
  26. }