irishdan /
ResponsiveImageBundle
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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
|
|||
| 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
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 |
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.