LazyOpenCloudSpec.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace spec\Gaufrette\Adapter;
  3. use OpenCloud\ObjectStore\Exception\ObjectNotFoundException;
  4. use PhpSpec\ObjectBehavior;
  5. use Prophecy\Argument;
  6. /**
  7. * LazyOpenCloudSpec
  8. *
  9. * @author Daniel Richter <nexyz9@gmail.com>
  10. */
  11. class LazyOpenCloudSpec extends ObjectBehavior
  12. {
  13. /**
  14. * @param \Gaufrette\Adapter\OpenStackCloudFiles\ObjectStoreFactoryInterface $objectStoreFactory
  15. */
  16. function let($objectStoreFactory)
  17. {
  18. $this->beConstructedWith($objectStoreFactory, 'test-container-name');
  19. }
  20. function it_is_adapter()
  21. {
  22. $this->shouldHaveType('Gaufrette\Adapter');
  23. }
  24. /**
  25. * @param \Gaufrette\Adapter\OpenStackCloudFiles\ObjectStoreFactoryInterface $objectStoreFactory
  26. * @param \OpenCloud\ObjectStore\Service $objectStore
  27. * @param \OpenCloud\ObjectStore\Resource\Container $container
  28. */
  29. function it_initializes_object_store($objectStoreFactory, $objectStore, $container)
  30. {
  31. $objectStoreFactory->getObjectStore()->shouldBeCalled()->willReturn($objectStore);
  32. $objectStore->getContainer("test-container-name")->shouldBeCalled()->willReturn($container);
  33. $container->getObject("test-file-name")->willThrow(new ObjectNotFoundException());
  34. $this->exists("test-file-name");
  35. }
  36. }