public function testGetS3Client() { self::assertSame($this->s3Client, $this->sut->getS3Client()); /** @var S3Client $expected */ $expected = $this->getMockBuilder(S3Client::class)->disableOriginalConstructor()->getMock(); $this->sut->setS3Client($expected); self::assertSame($expected, $this->sut->getS3Client()); }
/** * @param ClaimCheck $claimCheck * @return string * @throws ExceptionInterface */ private function fetchClaimCheckFromS3(ClaimCheck $claimCheck) { $s3Client = $this->configuration->getS3Client(); $result = $s3Client->getObject(['Bucket' => $claimCheck->getS3BucketName(), 'Key' => $claimCheck->getS3Key()]); $body = $result->get('Body'); // Unpack the message. if ($body instanceof StreamInterface) { try { return $body->getContents(); } catch (\RuntimeException $e) { throw new RuntimeException($e->getMessage(), 0, $e); } } return $body; }