function it_returns_a_string_if_storages_are_not_valid(StorageFactory $storageFactory, Storage $storage_1, Storage $storage_2) { $exception1 = new TokenNotSetException('Omg, what have you done??'); $exception2 = new InvalidStorageException('Forget about it. Go play some left 4 dead 2.'); $storageFactory->makeAll()->willReturn(array($storage_1, $storage_2)); $storage_1->validate()->shouldBeCalled()->willThrow($exception1); $storage_2->validate()->shouldBeCalled()->willThrow($exception2); $this->beConstructedWith($storageFactory); $this->validate(); $this->getValidationErrorsString()->shouldBe("Error 1: Omg, what have you done??\nError 2: Forget about it. Go play some left 4 dead 2."); }
function it_makes_the_backup(Element $element, Storage $storage) { $this->setName('my_project'); $this->setStorages(array($storage)); $this->setElements(array($element)); $element->setExtractionDir(__DIR__)->shouldBeCalled(); $element->extract()->shouldBeCalled(); $element->getExtractedFiles()->shouldBeCalled()->willReturn(array('a', 'b')); $storage->store('a', 'my_project')->shouldBeCalled(); $storage->store('b', 'my_project')->shouldBeCalled(); $this->backup(__DIR__); }