ImageEntityNameResolverTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of the IrishDan\ResponsiveImageBundle package.
4
 *
5
 * (c) Daniel Byrne <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE file that was distributed with this source
8
 * code.
9
 */
10
11
namespace IrishDan\ResponsiveImageBundle;
12
13
14
use Symfony\Component\Cache\Simple\FilesystemCache;
15
16
class ImageEntityNameResolverTest extends \PHPUnit_Framework_TestCase
17
{
18
    protected $cache;
19
20
    public function setUp()
21
    {
22
        // Clear the cache
23
        $this->cache = new FilesystemCache();
24
        $this->cache->delete('responsive_image.image_entity');
25
    }
26
27 View Code Duplication
    public function testReturnsTheLocatedClassName()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
    {
29
        $fileLocator = $this->getMockBuilder(ImageEntityClassLocator::class)
30
                            ->disableOriginalConstructor()
31
                            ->getMock();
32
33
        $fileLocator->expects($this->once())
34
                    ->method('getClassName')
35
                    ->will($this->returnValue('This\Is\Located'));
36
37
        $nameResolver = new ImageEntityNameResolver($fileLocator);
38
39
        $this->assertEquals('This\Is\Located', $nameResolver->getClassName());
40
    }
41
42 View Code Duplication
    public function testConfiguredValueTrumpsAll()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        // Mock the ImageEntityClassLocator to return the mock of the repository
45
        $fileLocator = $this->getMockBuilder(ImageEntityClassLocator::class)
46
                            ->disableOriginalConstructor()
47
                            ->getMock();
48
        $fileLocator->expects($this->never())->method('getClassName');
49
50
        $nameResolver = new ImageEntityNameResolver($fileLocator, 'This\Is\Configured');
51
52
        $this->assertEquals('This\Is\Configured', $nameResolver->getClassName());
53
    }
54
}
55