LocalSpec.php 901 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace spec\Gaufrette\Stream;
  3. use PhpSpec\ObjectBehavior;
  4. use Gaufrette\StreamMode;
  5. use org\bovigo\vfs\vfsStream;
  6. class LocalSpec extends ObjectBehavior
  7. {
  8. function it_throws_runtime_exception_when_file_doesnt_exists()
  9. {
  10. $this->beConstructedWith(vfsStream::url('other'));
  11. $this->shouldThrow('\RuntimeException')->duringOpen(new StreamMode('r'));
  12. }
  13. function it_throws_runtime_exception_when_file_doesnt_exists_and_custom_error_handler_specified()
  14. {
  15. $custom_error_handler = function ($errno, $errstr, $errfile, $errline) {
  16. throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
  17. };
  18. set_error_handler($custom_error_handler);
  19. $this->beConstructedWith(vfsStream::url('other'));
  20. $this->shouldThrow('\RuntimeException')->duringOpen(new StreamMode('r'));
  21. restore_error_handler();
  22. }
  23. }