/** * Should pre-process and transfer an image. */ public function testHandle() { $filename = '/tmp/' . uniqid(); file_put_contents($filename, ''); $this->image->expects($this->atLeastOnce())->method('storageLocation')->willReturn($filename); $preProcessed = $this->makeMock(ImagickContract::class); $this->imagePreProcessor->expects($this->atLeastOnce())->method('preProcess')->with($this->image)->willReturn(new ImagickCollection([$preProcessed])); $this->config->expects($this->atLeastOnce())->method('get')->willReturn('foobar_endpoint'); $fileContent = 'foo bar'; $preProcessed->expects($this->atLeastOnce())->method('getImageBlob')->willReturn($fileContent); $this->filesystem->expects($this->atLeastOnce())->method('put')->with($this->isType('string'), $fileContent, $this->isType('array')); $this->newImageListener->handle($this->event); }