Skip to content

Commit 21f1eb3

Browse files
Improved integration test
1 parent 60c0163 commit 21f1eb3

File tree

1 file changed

+10
-7
lines changed
  • dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images

1 file changed

+10
-7
lines changed

dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
*/
77
namespace Magento\Cms\Model\Wysiwyg\Images;
88

9+
use Magento\Cms\Model\Wysiwyg\Images\Storage\Collection;
910
use Magento\Framework\App\Filesystem\DirectoryList;
11+
use Magento\Framework\DataObject;
1012
use Magento\Framework\Filesystem;
1113
use Magento\Framework\Filesystem\Driver\File;
1214
use Magento\Framework\Filesystem\DriverInterface;
@@ -105,18 +107,19 @@ public function testGetFilesCollection(): void
105107
);
106108
$this->storage->resizeFile($modifiableFilePath);
107109
$collection = $this->storage->getFilesCollection(self::$_baseDir, 'image');
108-
$this->assertInstanceOf(\Magento\Cms\Model\Wysiwyg\Images\Storage\Collection::class, $collection);
110+
$this->assertInstanceOf(Collection::class, $collection);
109111
foreach ($collection as $item) {
110-
$this->assertInstanceOf(\Magento\Framework\DataObject::class, $item);
112+
$this->assertInstanceOf(DataObject::class, $item);
111113
$this->assertStringEndsWith('/' . $fileName, $item->getUrl());
112-
$this->assertMatchesRegularExpression(
113-
'/.thumbsMagentoCmsModelWysiwygImagesStorageTest/',
114-
'http://%s/pub/%s/.thumbsMagentoCmsModelWysiwygImagesStorageTest/magento_image.jpg',
115-
$item->getThumbUrl()
114+
$this->assertEquals(
115+
'/pub/media/.thumbsMagentoCmsModelWysiwygImagesStorageTest/magento_image.jpg',
116+
parse_url($item->getThumbUrl(), PHP_URL_PATH),
117+
"Check if Thumbnail URL is equal to the generated URL"
116118
);
117119
$this->assertEquals(
118120
'image/jpeg',
119-
$item->getMimeType()
121+
$item->getMimeType(),
122+
"Check if Mime Type is equal to the image in the file system"
120123
);
121124
return;
122125
}

0 commit comments

Comments
 (0)