LazyOpenCloudSpec.php 1.5 KB

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