ChecksumSpec.php 741 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace spec\Gaufrette\Util;
  3. use PHPSpec\ObjectBehavior;
  4. class ChecksumSpec extends ObjectBehavior
  5. {
  6. function let()
  7. {
  8. $path = __DIR__.DIRECTORY_SEPARATOR.'testFile';
  9. file_put_contents($path, 'some other content');
  10. }
  11. function it_calculates_checksum_from_content()
  12. {
  13. $this->fromContent('some content')->shouldReturn(md5('some content'));
  14. }
  15. function it_calculates_checksum_from_filepath()
  16. {
  17. $path = __DIR__.DIRECTORY_SEPARATOR.'testFile';
  18. $this->fromFile($path)->shouldReturn(md5('some other content'));
  19. }
  20. function letgo()
  21. {
  22. $path = __DIR__.DIRECTORY_SEPARATOR.'testFile';
  23. @unlink(__DIR__.DIRECTORY_SEPARATOR.'testFile');
  24. }
  25. }