13 class Gd2Test extends \PHPUnit\Framework\TestCase
43 require_once
__DIR__ .
'/_files/global_php_mock.php';
45 $this->adapter = $this->objectManager->getObject(\
Magento\Framework\
Image\Adapter\Gd2::class);
53 $this->assertInstanceOf(\
Magento\Framework\
Image\Adapter\AbstractAdapter::class, $this->adapter);
64 public function testOpen($fileData, $exception, $limit)
66 self::$memoryLimit = $limit;
67 self::$imageData = $fileData;
69 if (!empty($exception)) {
70 $this->expectException($exception);
73 $this->adapter->open(
'file');
85 3 =>
'width="480" height="320"',
88 'mime' =>
'image/jpeg',
95 3 =>
'width="3579" height="2398"',
98 'mime' =>
'image/jpeg',
102 'positive_M' => [$smallFile,
false,
'2M'],
103 'positive_KB' => [$smallFile,
false,
'2048K'],
104 'negative_KB' => [$bigFile,
'OverflowException',
'2048K'],
105 'negative_bytes' => [$bigFile,
'OverflowException',
'2048000'],
106 'no_limit' => [$bigFile,
false,
'-1'],
120 3 =>
'width="480" height="320"',
123 'mime' =>
'image/jpeg',
126 $this->adapter->open(
'file');
127 $type1 = $this->adapter->getImageType();
133 3 =>
'width="480" height="320"',
136 'mime' =>
'image/png',
139 $this->adapter->open(
'file');
140 $type2 = $this->adapter->getImageType();
142 $this->assertNotEquals($type1, $type2);
defined('TESTS_BP')||define('TESTS_BP' __DIR__
testOpen($fileData, $exception, $limit)