public function testLogNotCreatedObjects()
 {
     $response = new Response();
     $response->setContent('foo');
     $response->headers->set('Content-Type', 'image/jpeg');
     $s3 = $this->getMock('Aws\\S3\\S3Client');
     $s3->expects($this->once())->method('putObject')->will($this->throwException(new \Exception()));
     $logger = $this->getMockForAbstractClass('Symfony\\Component\\HttpKernel\\Log\\LoggerInterface');
     $logger->expects($this->once())->method('warn');
     $resolver = new AwsS3Resolver($s3, 'images.example.com');
     $resolver->setLogger($logger);
     $this->assertSame($response, $resolver->store($response, 'foobar.jpg', 'thumb'));
 }
示例#2
0
 public function testCatchAndLogExceptionForFilterOnRemove()
 {
     $expectedBucket = 'images.example.com';
     $expectedFilter = 'theFilter';
     $s3 = $this->getS3ClientMock();
     $s3->expects($this->once())->method('deleteMatchingObjects')->will($this->throwException(new \Exception()));
     $logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $logger->expects($this->once())->method('error');
     $resolver = new AwsS3Resolver($s3, $expectedBucket);
     $resolver->setLogger($logger);
     $resolver->remove(array(), array($expectedFilter));
 }