forked from ems-project/elasticms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(image): resize on generate image
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
EMS/common-bundle/tests/Unit/Images/ImageProcessorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace EMS\CommonBundle\Tests\Unit\Images; | ||
|
||
use EMS\CommonBundle\Storage\Processor\Config; | ||
use EMS\CommonBundle\Storage\Processor\Image; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Log\LoggerInterface; | ||
|
||
class ImageProcessorTest extends TestCase | ||
{ | ||
public function testResizeImage(): void | ||
{ | ||
$config = $this->createMock(Config::class); | ||
$config->method('getConfigType')->willReturn('image'); | ||
$config->method('getWidth')->willReturn(2880); | ||
$config->method('getHeight')->willReturn(1160); | ||
$config->method('getQuality')->willReturn(0); | ||
$config->method('getResize')->willReturn('fillArea'); | ||
$logger = $this->createMock(LoggerInterface::class); | ||
$image = new Image($config, $logger); | ||
$generatedImage = $image->generate(__DIR__.DIRECTORY_SEPARATOR.'visuel_giant.jpg'); | ||
\getimagesize($generatedImage); | ||
|
||
$this->assertSame([ | ||
0 => 2880, | ||
1 => 1160, | ||
2 => 3, | ||
3 => 'width="2880" height="1160"', | ||
'bits' => 8, | ||
'mime' => 'image/png', | ||
], \getimagesize($generatedImage)); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.