/** * @param $archive */ private function archiveAlreadyExists(Archive $archive) { foreach ($this->responders as $responder) { /** * @var CreateArchiveResponder $responder */ $responder->archiveAlreadyExists($archive->getName()); } }
function it_passes_listed_archives_to_responder(ArchiveListResponder $archiveListResponder, ArchiveRepository $archiveRepository, Archive $archive, Archive $uploadedArchive) { $archive->getName()->willReturn('first'); $archive->isUploaded()->willReturn(false); $uploadedArchive->getName()->willReturn('second'); $uploadedArchive->isUploaded()->willReturn(true); $this->addResponder($archiveListResponder); $archiveRepository->findAll()->willReturn([$archive, $uploadedArchive])->shouldBeCalled(); $archiveListResponder->archiveListFechted(Argument::that(function ($response) { return $response->items[0]->archiveName == 'first' && $response->items[0]->uploaded == false && $response->items[1]->archiveName == 'second' && $response->items[1]->uploaded == true; }))->shouldBeCalled(); $this->execute(); }
/** * @return string */ public function getName() { return $this->archive->getName(); }
function it_is_archive_proxy(Archive $archive) { $archive->getName()->willReturn('Name'); $this->getName()->shouldBe('Name'); }
function it_adds_archive_to_repository(Archive $archive) { $archive->getName()->willReturn('archiveName'); $this->add($archive); $this->findByName('archiveName')->shouldReturn($archive); }