Example #1
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));
 }
 public function testRemoveNotExisting()
 {
     $s3 = $this->getMock('Aws\\S3\\S3Client');
     $s3->expects($this->once())->method('doesObjectExist')->with('images.example.com', 'thumb/some-folder/targetpath.jpg')->will($this->returnValue(false));
     $s3->expects($this->never())->method('deleteObject');
     $resolver = new AwsS3Resolver($s3, 'images.example.com');
     $this->assertTrue($resolver->remove('thumb/some-folder/targetpath.jpg', 'thumb'));
 }