public function validate() { foreach ($this->storageFactory->makeAll() as $storage) { try { $storage->validate(); } catch (TokenNotSetException $e) { $this->errors[] = $e->getMessage(); } catch (InvalidStorageException $e) { $this->errors[] = $e->getMessage(); } } }
function it_returns_false_if_storages_are_valid(StorageFactory $storageFactory, Storage $storage_1, Storage $storage_2) { $storageFactory->makeAll()->willReturn(array($storage_1, $storage_2)); $this->beConstructedWith($storageFactory); $this->validate(); $this->getValidationErrorsString()->shouldReturn(false); }