@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use IrishDan\ResponsiveImageBundle\Event\ImageEvent; |
| 15 | 15 | use IrishDan\ResponsiveImageBundle\Event\ImageEvents; |
| 16 | 16 | use IrishDan\ResponsiveImageBundle\ImageProcessing\ImageManager; |
| 17 | -use Psr\Log\LoggerInterface; |
|
| 18 | 17 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
| 19 | 18 | |
| 20 | 19 | /** |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | use IrishDan\ResponsiveImageBundle\Event\UploaderEvent; |
| 14 | 14 | use IrishDan\ResponsiveImageBundle\Event\UploaderEvents; |
| 15 | 15 | use League\Flysystem\FilesystemInterface; |
| 16 | -use Psr\Log\LoggerInterface; |
|
| 17 | 16 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
| 18 | 17 | |
| 19 | 18 | /** |
@@ -45,21 +45,21 @@ |
||
| 45 | 45 | |
| 46 | 46 | // Mock the EntityManager to return the mock of the repository |
| 47 | 47 | $entityManager = $this->getMockBuilder(EntityManager::class) |
| 48 | - ->disableOriginalConstructor() |
|
| 49 | - ->getMock(); |
|
| 48 | + ->disableOriginalConstructor() |
|
| 49 | + ->getMock(); |
|
| 50 | 50 | |
| 51 | 51 | $entityManager->expects($this->any()) |
| 52 | - ->method('getRepository') |
|
| 53 | - ->will($this->returnValue($imageRepository)); |
|
| 52 | + ->method('getRepository') |
|
| 53 | + ->will($this->returnValue($imageRepository)); |
|
| 54 | 54 | |
| 55 | 55 | // The mock the ImageEntityName |
| 56 | 56 | $nameResolver = $this->getMockBuilder(ImageEntityNameResolver::class) |
| 57 | - ->disableOriginalConstructor() |
|
| 58 | - ->getMock(); |
|
| 57 | + ->disableOriginalConstructor() |
|
| 58 | + ->getMock(); |
|
| 59 | 59 | |
| 60 | 60 | $nameResolver->expects($this->once()) |
| 61 | - ->method('getClassName') |
|
| 62 | - ->will($this->returnValue('ResponsiveImage')); |
|
| 61 | + ->method('getClassName') |
|
| 62 | + ->will($this->returnValue('ResponsiveImage')); |
|
| 63 | 63 | |
| 64 | 64 | $fileToObject = new FileToObject($entityManager, $nameResolver); |
| 65 | 65 | |
@@ -20,29 +20,29 @@ |
||
| 20 | 20 | { |
| 21 | 21 | // Mock the repository so it returns the mock of the Image repository. |
| 22 | 22 | $fileToObject = $this->getMockBuilder(FileToObject::class) |
| 23 | - ->disableOriginalConstructor() |
|
| 24 | - ->getMock(); |
|
| 23 | + ->disableOriginalConstructor() |
|
| 24 | + ->getMock(); |
|
| 25 | 25 | |
| 26 | 26 | $fileToObject->expects($this->any()) |
| 27 | - ->method('getObjectFromFilename') |
|
| 28 | - ->will( |
|
| 29 | - $this->returnCallback( |
|
| 30 | - function ($filename) { |
|
| 31 | - $existingFilenames = [ |
|
| 32 | - 'test.jpg', |
|
| 33 | - 'test_1.jpg', |
|
| 34 | - ]; |
|
| 35 | - if (in_array($filename, $existingFilenames)) { |
|
| 36 | - $image = new TestImage(); |
|
| 37 | - |
|
| 38 | - return $image; |
|
| 39 | - } |
|
| 40 | - else { |
|
| 41 | - return null; |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - ) |
|
| 45 | - ); |
|
| 27 | + ->method('getObjectFromFilename') |
|
| 28 | + ->will( |
|
| 29 | + $this->returnCallback( |
|
| 30 | + function ($filename) { |
|
| 31 | + $existingFilenames = [ |
|
| 32 | + 'test.jpg', |
|
| 33 | + 'test_1.jpg', |
|
| 34 | + ]; |
|
| 35 | + if (in_array($filename, $existingFilenames)) { |
|
| 36 | + $image = new TestImage(); |
|
| 37 | + |
|
| 38 | + return $image; |
|
| 39 | + } |
|
| 40 | + else { |
|
| 41 | + return null; |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + ) |
|
| 45 | + ); |
|
| 46 | 46 | |
| 47 | 47 | $transliterator = new FilenameTransliterator($fileToObject); |
| 48 | 48 | |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $uploadedFile = $this->getMockFileUpload(); |
| 29 | 29 | $uploadedFile->expects($this->once()) |
| 30 | - ->method('getClientOriginalExtension') |
|
| 31 | - ->will( |
|
| 32 | - $this->returnValue('jpg') |
|
| 33 | - ); |
|
| 30 | + ->method('getClientOriginalExtension') |
|
| 31 | + ->will( |
|
| 32 | + $this->returnValue('jpg') |
|
| 33 | + ); |
|
| 34 | 34 | $uploadedFile->expects($this->once()) |
| 35 | - ->method('guessExtension') |
|
| 36 | - ->will( |
|
| 37 | - $this->returnValue('jpg') |
|
| 38 | - ); |
|
| 35 | + ->method('guessExtension') |
|
| 36 | + ->will( |
|
| 37 | + $this->returnValue('jpg') |
|
| 38 | + ); |
|
| 39 | 39 | |
| 40 | 40 | // Test the validator. |
| 41 | 41 | $validator = new FileValidator(); |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $uploadedFile = $this->getMockFileUpload(); |
| 51 | 51 | $uploadedFile->expects($this->once()) |
| 52 | - ->method('getClientOriginalExtension') |
|
| 53 | - ->will( |
|
| 54 | - $this->returnValue('doc') |
|
| 55 | - ); |
|
| 52 | + ->method('getClientOriginalExtension') |
|
| 53 | + ->will( |
|
| 54 | + $this->returnValue('doc') |
|
| 55 | + ); |
|
| 56 | 56 | $uploadedFile->expects($this->once()) |
| 57 | - ->method('guessExtension') |
|
| 58 | - ->will( |
|
| 59 | - $this->returnValue('doc') |
|
| 60 | - ); |
|
| 57 | + ->method('guessExtension') |
|
| 58 | + ->will( |
|
| 59 | + $this->returnValue('doc') |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | 62 | // Test the validator. |
| 63 | 63 | $validator = new FileValidator(); |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $uploadedFile = $this->getMockFileUpload(); |
| 73 | 73 | $uploadedFile->expects($this->once()) |
| 74 | - ->method('getClientOriginalExtension') |
|
| 75 | - ->will( |
|
| 76 | - $this->returnValue('jpg') |
|
| 77 | - ); |
|
| 74 | + ->method('getClientOriginalExtension') |
|
| 75 | + ->will( |
|
| 76 | + $this->returnValue('jpg') |
|
| 77 | + ); |
|
| 78 | 78 | $uploadedFile->expects($this->once()) |
| 79 | - ->method('guessExtension') |
|
| 80 | - ->will( |
|
| 81 | - $this->returnValue('png') |
|
| 82 | - ); |
|
| 79 | + ->method('guessExtension') |
|
| 80 | + ->will( |
|
| 81 | + $this->returnValue('png') |
|
| 82 | + ); |
|
| 83 | 83 | |
| 84 | 84 | // Test the validator. |
| 85 | 85 | $validator = new FileValidator(); |
@@ -53,8 +53,8 @@ |
||
| 53 | 53 | |
| 54 | 54 | if (!$valid) { |
| 55 | 55 | $this->context->buildViolation($constraint->message) |
| 56 | - ->setParameter('{{ string }}', $value) |
|
| 57 | - ->addViolation() |
|
| 56 | + ->setParameter('{{ string }}', $value) |
|
| 57 | + ->addViolation() |
|
| 58 | 58 | ; |
| 59 | 59 | } |
| 60 | 60 | } |