PathSpec.php 775 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace spec\Gaufrette\Util;
  3. use PhpSpec\ObjectBehavior;
  4. class PathSpec extends ObjectBehavior
  5. {
  6. function it_checks_if_path_is_absolute()
  7. {
  8. $this->isAbsolute('/home/path')->shouldBe(true);
  9. $this->isAbsolute('home/path')->shouldBe(false);
  10. $this->isAbsolute('../home/path')->shouldBe(false);
  11. }
  12. function it_normalizes_file_path()
  13. {
  14. $this->normalize('C:\\some\other.txt')->shouldReturn('c:/some/other.txt');
  15. $this->normalize('..\other.txt')->shouldReturn('../other.txt');
  16. $this->normalize('..\other.txt')->shouldReturn('../other.txt');
  17. $this->normalize('/home/other/../new')->shouldReturn('/home/new');
  18. $this->normalize('/home/other/./new')->shouldReturn('/home/other/new');
  19. }
  20. }