SafeLocalSpec.php 878 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace spec\Gaufrette\Adapter;
  3. //hack - mock php built-in functions
  4. require_once 'functions.php';
  5. use PhpSpec\ObjectBehavior;
  6. class SafeLocalSpec extends ObjectBehavior
  7. {
  8. function let()
  9. {
  10. $this->beConstructedWith('/home/l3l0');
  11. }
  12. function it_is_local_adapter()
  13. {
  14. $this->shouldHaveType('Gaufrette\Adapter\Local');
  15. }
  16. function it_computes_path_using_base64()
  17. {
  18. $this->read('filename')->shouldReturn('/home/l3l0/'.base64_encode('filename').' content');
  19. }
  20. function it_computes_key_back_using_base64()
  21. {
  22. global $iteratorToArray;
  23. $iteratorToArray = array('/home/l3l0/'.base64_encode('filename'), '/home/l3l0/'.base64_encode('filename1'), '/home/l3l0/'.base64_encode('aaa/filename'));
  24. $this->keys()->shouldReturn(array('aaa', 'aaa/filename', 'filename', 'filename1'));
  25. }
  26. }