File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
AdobeStockImage/Test/Unit/Model/Storage Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1010use Magento \AdobeStockImage \Model \Storage \Save ;
1111use Magento \Framework \App \Filesystem \DirectoryList ;
1212use Magento \Framework \Exception \AlreadyExistsException ;
13+ use Magento \Framework \Exception \LocalizedException ;
1314use Magento \Framework \Filesystem ;
1415use Magento \Framework \Filesystem \Directory \Write ;
1516use 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}
You can’t perform that action at this time.
0 commit comments