Skip to content

Commit 1e369cc

Browse files
committed
MC-41843: Unit test for maximum characters updated
1 parent e4a2034 commit 1e369cc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

AdobeStockImage/Test/Unit/Model/Storage/SaveTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\AdobeStockImage\Model\Storage\Save;
1111
use Magento\Framework\App\Filesystem\DirectoryList;
1212
use Magento\Framework\Exception\AlreadyExistsException;
13+
use Magento\Framework\Exception\LocalizedException;
1314
use Magento\Framework\Filesystem;
1415
use Magento\Framework\Filesystem\Directory\Write;
1516
use Magento\Framework\Filesystem\Driver\Https;
@@ -123,4 +124,18 @@ public function testExceptionOnSaveExecution(): void
123124

124125
$this->save->execute($imageUrl, '/240_F_272299924_HjNOJkyyhzFVKRcSQ2TaArR7Ka6nTXRa.jpg');
125126
}
127+
128+
/**
129+
* Assume that execute will thrown an Exception for mexFileLength (default: 255 chars)
130+
*/
131+
public function testExceptionOnMaxFileLength(): void
132+
{
133+
$imageUrl = 'https://t4.ftcdn.net/jpg/02/72/29/99/240_F_272299924_HjNOJkyyhzFVKRcSQ2TaArR7Ka6nTXRa.jpg';
134+
135+
$destinationPath = '/test-destination-path/this_destination_path_has_more_than_255_chars_to_check_exception_//jpg/02/72/29/99//jpg/02/72/29/99//jpg/02/72/29/99//240_F_272299924_HjNOJkyyhzFVKRcSQ2TaArR7Ka6nTXRa_HjNOJkyyhzFVKRcSQ2TaArR7Ka6nTXRa_HjNOJkyyhzFVKRcSQ2TaArR7Ka6nTXRa.jpg';
136+
137+
$this->expectException(LocalizedException::class);
138+
139+
$this->save->execute($imageUrl, $destinationPath);
140+
}
126141
}

0 commit comments

Comments
 (0)