Code Duplication    Length = 26-26 lines in 2 locations

Tests/Imagine/Cache/Resolver/AmazonS3ResolverTest.php 1 location

@@ 48-73 (lines=26) @@
45
        $resolver->resolve('/some-folder/path.jpg', 'thumb');
46
    }
47
48
    public function testThrowsAndLogIfCanNotCreateObjectOnAmazon()
49
    {
50
        $binary = new Binary('aContent', 'image/jpeg', 'jpeg');
51
52
        $s3 = $this->createAmazonS3Mock();
53
        $s3
54
            ->expects($this->once())
55
            ->method('create_object')
56
            ->will($this->returnValue($this->createCFResponseMock(false)))
57
        ;
58
59
        $logger = $this->getMock('Psr\Log\LoggerInterface');
60
        $logger
61
            ->expects($this->once())
62
            ->method('error')
63
        ;
64
65
        $resolver = new AmazonS3Resolver($s3, 'images.example.com');
66
        $resolver->setLogger($logger);
67
68
        $this->setExpectedException(
69
            'Liip\ImagineBundle\Exception\Imagine\Cache\Resolver\NotStorableException',
70
            'The object could not be created on Amazon S3.'
71
        );
72
        $resolver->store($binary, 'foobar.jpg', 'thumb');
73
    }
74
75
    public function testCreatedObjectOnAmazon()
76
    {

Tests/Imagine/Cache/Resolver/AwsS3ResolverTest.php 1 location

@@ 48-73 (lines=26) @@
45
        $resolver->resolve('/some-folder/path.jpg', 'thumb');
46
    }
47
48
    public function testLogNotCreatedObjects()
49
    {
50
        $binary = new Binary('aContent', 'image/jpeg', 'jpeg');
51
52
        $s3 = $this->getS3ClientMock();
53
        $s3
54
            ->expects($this->once())
55
            ->method('putObject')
56
            ->will($this->throwException(new \Exception('Put object on amazon failed')))
57
        ;
58
59
        $logger = $this->getMock('Psr\Log\LoggerInterface');
60
        $logger
61
            ->expects($this->once())
62
            ->method('error')
63
        ;
64
65
        $resolver = new AwsS3Resolver($s3, 'images.example.com');
66
        $resolver->setLogger($logger);
67
68
        $this->setExpectedException(
69
            'Liip\ImagineBundle\Exception\Imagine\Cache\Resolver\NotStorableException',
70
            'The object could not be created on Amazon S3.'
71
        );
72
        $resolver->store($binary, 'foobar.jpg', 'thumb');
73
    }
74
75
    public function testCreateObjectOnAmazon()
76
    {