+ getHtmlId() . rand(); ?>
+
= $block->getFormHtml() ?>
= /* @noEscape */ $secureRenderer->renderStyleAsTag(
'display:none',
- 'div#new_video_' . /* @noEscape */ $block->getNewVideoBlockName()
+ 'div#' . $videoBlockId
) ?>
= $block->getChildHtml('new-video') ?>
diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridSelectAllActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridSelectAllActionGroup.xml
new file mode 100644
index 0000000000000..bbfb7e46d89ec
--- /dev/null
+++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridSelectAllActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ Click on select all option on the grid
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js
index ba0f4d25c25a4..828bbccee0478 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js
@@ -52,6 +52,7 @@ define([
listens: {
'${ $.provider }:params.filters': 'onFilter',
+ '${ $.provider }:params.search': 'onSearch',
selected: 'onSelectedChange',
rows: 'onRowsChange'
},
@@ -235,7 +236,7 @@ define([
* @returns {Multiselect} Chainable.
*/
togglePage: function () {
- return this.isPageSelected() ? this.deselectPage() : this.selectPage();
+ return this.isPageSelected() && !this.excluded().length ? this.deselectPage() : this.selectPage();
},
/**
@@ -496,6 +497,13 @@ define([
if (!this.preserveSelectionsOnFilter) {
this.deselectAll();
}
+ },
+
+ /**
+ * Is invoked when search is applied or removed
+ */
+ onSearch: function () {
+ this.onFilter();
}
});
});
diff --git a/app/code/Magento/User/i18n/en_US.csv b/app/code/Magento/User/i18n/en_US.csv
index 064b6428387fe..cd550015401d0 100644
--- a/app/code/Magento/User/i18n/en_US.csv
+++ b/app/code/Magento/User/i18n/en_US.csv
@@ -106,8 +106,8 @@ username,username
Custom,Custom
All,All
Resources,Resources
-"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?"
-"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?"
+"Warning!
This action will remove this user from already assigned role.
Are you sure?","Warning!
This action will remove this user from already assigned role.
Are you sure?"
+"Warning!
This action will remove those users from already assigned roles.
Are you sure?","Warning!
This action will remove those users from already assigned roles.
Are you sure?"
"Password Reset Confirmation for %name","Password Reset Confirmation for %name"
"%name,","%name,"
"There was recently a request to change the password for your account.","There was recently a request to change the password for your account."
diff --git a/app/code/Magento/User/view/adminhtml/templates/role/users_grid_js.phtml b/app/code/Magento/User/view/adminhtml/templates/role/users_grid_js.phtml
index 2042479832898..b0107a53593d3 100644
--- a/app/code/Magento/User/view/adminhtml/templates/role/users_grid_js.phtml
+++ b/app/code/Magento/User/view/adminhtml/templates/role/users_grid_js.phtml
@@ -51,8 +51,8 @@ if (is_object($myBlock) && $myBlock->getJsObjectName()):
if (checked) {
confirm({
- content: "{$myBlock->escapeJs(__('Warning!\r\nThis action will remove this user from already ' .
- 'assigned role\r\nAre you sure?'))}",
+ content: "{$myBlock->escapeJs(__('Warning!
This action will remove this user from already ' .
+ 'assigned role.
Are you sure?'))}",
actions: {
confirm: function () {
checkbox[0].checked = false;
@@ -102,7 +102,7 @@ if (is_object($myBlock) && $myBlock->getJsObjectName()):
allCheckbox.checked = true;
confirm({
content: "{$myBlock->escapeJs(
- __('Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?')
+ __('Warning!
This action will remove those users from already assigned roles.
Are you sure?')
)}",
actions: {
confirm: function () {
diff --git a/app/code/Magento/User/view/adminhtml/templates/user/roles_grid_js.phtml b/app/code/Magento/User/view/adminhtml/templates/user/roles_grid_js.phtml
index 71a866f945693..7455c26334c02 100644
--- a/app/code/Magento/User/view/adminhtml/templates/user/roles_grid_js.phtml
+++ b/app/code/Magento/User/view/adminhtml/templates/user/roles_grid_js.phtml
@@ -45,7 +45,7 @@ if (is_object($myBlock) && $myBlock->getJsObjectName()):
var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
if (checked && warning && radioBoxes.size() > 0) {
if ( !confirm("{$myBlock->escapeJs(
- __('Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?')
+ __('Warning!
This action will remove this user from already assigned role.
Are you sure?')
)}") ) {
checkbox[0].checked = false;
for(i in radioBoxes) {
diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php
index a68a546c20bc6..cb96ca2a14cac 100644
--- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php
+++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php
@@ -6,7 +6,13 @@
*/
namespace Magento\Cms\Model\Wysiwyg\Images;
+use Magento\Cms\Model\Wysiwyg\Images\Storage\Collection;
use Magento\Framework\App\Filesystem\DirectoryList;
+use Magento\Framework\DataObject;
+use Magento\Framework\Filesystem;
+use Magento\Framework\Filesystem\Driver\File;
+use Magento\Framework\Filesystem\DriverInterface;
+use Magento\TestFramework\Helper\Bootstrap;
/**
* Test methods of class Storage
@@ -29,22 +35,27 @@ class StorageTest extends \PHPUnit\Framework\TestCase
private $objectManager;
/**
- * @var \Magento\Framework\Filesystem
+ * @var Filesystem
*/
private $filesystem;
/**
- * @var \Magento\Cms\Model\Wysiwyg\Images\Storage
+ * @var Storage
*/
private $storage;
+ /**
+ * @var DriverInterface
+ */
+ private $driver;
+
/**
* @inheritdoc
*/
// phpcs:disable
public static function setUpBeforeClass(): void
{
- self::$_baseDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ self::$_baseDir = Bootstrap::getObjectManager()->get(
\Magento\Cms\Helper\Wysiwyg\Images::class
)->getCurrentPath() . 'MagentoCmsModelWysiwygImagesStorageTest';
if (!file_exists(self::$_baseDir)) {
@@ -60,8 +71,8 @@ public static function setUpBeforeClass(): void
// phpcs:ignore
public static function tearDownAfterClass(): void
{
- \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
- \Magento\Framework\Filesystem\Driver\File::class
+ Bootstrap::getObjectManager()->create(
+ File::class
)->deleteDirectory(
self::$_baseDir
);
@@ -72,9 +83,10 @@ public static function tearDownAfterClass(): void
*/
protected function setUp(): void
{
- $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $this->filesystem = $this->objectManager->get(\Magento\Framework\Filesystem::class);
- $this->storage = $this->objectManager->create(\Magento\Cms\Model\Wysiwyg\Images\Storage::class);
+ $this->objectManager = Bootstrap::getObjectManager();
+ $this->filesystem = $this->objectManager->get(Filesystem::class);
+ $this->storage = $this->objectManager->create(Storage::class);
+ $this->driver = Bootstrap::getObjectManager()->get(DriverInterface::class);
}
/**
@@ -83,16 +95,31 @@ protected function setUp(): void
*/
public function testGetFilesCollection(): void
{
- \Magento\TestFramework\Helper\Bootstrap::getInstance()
+ Bootstrap::getInstance()
->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE);
- $collection = $this->storage->getFilesCollection(self::$_baseDir, 'media');
- $this->assertInstanceOf(\Magento\Cms\Model\Wysiwyg\Images\Storage\Collection::class, $collection);
+ $fileName = 'magento_image.jpg';
+ $imagePath = realpath(__DIR__ . '/../../../../Catalog/_files/' . $fileName);
+ $mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ $modifiableFilePath = $mediaDirectory->getAbsolutePath('MagentoCmsModelWysiwygImagesStorageTest/' . $fileName);
+ $this->driver->copy(
+ $imagePath,
+ $modifiableFilePath
+ );
+ $this->storage->resizeFile($modifiableFilePath);
+ $collection = $this->storage->getFilesCollection(self::$_baseDir, 'image');
+ $this->assertInstanceOf(Collection::class, $collection);
foreach ($collection as $item) {
- $this->assertInstanceOf(\Magento\Framework\DataObject::class, $item);
- $this->assertStringEndsWith('/1.swf', $item->getUrl());
- $this->assertStringMatchesFormat(
- 'http://%s/static/%s/adminhtml/%s/%s/Magento_Cms/images/placeholder_thumbnail.jpg',
- $item->getThumbUrl()
+ $this->assertInstanceOf(DataObject::class, $item);
+ $this->assertStringEndsWith('/' . $fileName, $item->getUrl());
+ $this->assertEquals(
+ '/pub/media/.thumbsMagentoCmsModelWysiwygImagesStorageTest/magento_image.jpg',
+ parse_url($item->getThumbUrl(), PHP_URL_PATH),
+ "Check if Thumbnail URL is equal to the generated URL"
+ );
+ $this->assertEquals(
+ 'image/jpeg',
+ $item->getMimeType(),
+ "Check if Mime Type is equal to the image in the file system"
);
return;
}
@@ -121,7 +148,7 @@ public function testDeleteDirectory(): void
$this->storage->createDirectory($dir, $path);
$this->assertFileExists($fullPath);
$this->storage->deleteDirectory($fullPath);
- $this->assertFileNotExists($fullPath);
+ $this->assertFileDoesNotExist($fullPath);
}
/**
@@ -142,7 +169,7 @@ public function testDeleteDirectoryWithExcludedDirPath(): void
public function testUploadFile(): void
{
$fileName = 'magento_small_image.jpg';
- $tmpDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::SYS_TMP);
+ $tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
$filePath = $tmpDirectory->getAbsolutePath($fileName);
// phpcs:disable
$fixtureDir = realpath(__DIR__ . '/../../../../Catalog/_files');
@@ -172,7 +199,7 @@ public function testUploadFileWithExcludedDirPath(): void
);
$fileName = 'magento_small_image.jpg';
- $tmpDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::SYS_TMP);
+ $tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
$filePath = $tmpDirectory->getAbsolutePath($fileName);
// phpcs:disable
$fixtureDir = realpath(__DIR__ . '/../../../../Catalog/_files');
@@ -204,7 +231,7 @@ public function testUploadFileWithWrongExtension(string $fileName, string $fileT
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
$this->expectExceptionMessage('File validation failed.');
- $tmpDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::SYS_TMP);
+ $tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
$filePath = $tmpDirectory->getAbsolutePath($fileName);
// phpcs:disable
$fixtureDir = realpath(__DIR__ . '/../../../_files');
@@ -251,7 +278,7 @@ public function testUploadFileWithWrongFile(): void
$this->expectExceptionMessage('File validation failed.');
$fileName = 'file.gif';
- $tmpDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::SYS_TMP);
+ $tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
$filePath = $tmpDirectory->getAbsolutePath($fileName);
// phpcs:disable
$file = fopen($filePath, "wb");
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/adminhtml/js/view/form/components/insert-listing.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/adminhtml/js/view/form/components/insert-listing.test.js
index 63ce265ac9001..e07b1fbc69453 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/adminhtml/js/view/form/components/insert-listing.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/adminhtml/js/view/form/components/insert-listing.test.js
@@ -18,7 +18,8 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
}
},
selectionsProvider = {
- selected: jasmine.createSpy().and.returnValue(ids)
+ selected: jasmine.createSpy().and.returnValue(ids),
+ deselect: jasmine.createSpy()
};
beforeEach(function () {
@@ -54,7 +55,7 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
expect(obj._delete).toHaveBeenCalledWith([1, 2]);
});
- it('Check removal of default addresses', function () {
+ it('Check removal of default addresses and selections by provided ids', function () {
obj.source = {
get: jasmine.createSpy().and.returnValues(2, 3),
set: jasmine.createSpy()
@@ -64,6 +65,7 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
expect(selectionsProvider.selected).not.toHaveBeenCalled();
expect(obj.source.get.calls.count()).toEqual(2);
expect(obj.source.set.calls.count()).toEqual(1);
+ expect(selectionsProvider.deselect.calls.count()).toEqual(2);
});
});
});
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js
index de3387e31af88..5975f21e08070 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js
@@ -135,6 +135,19 @@ define([
expect(multiSelect.selected().toString()).toEqual('3,4,1,2');
});
+ it('Select all rows all over the Grid and deselects all records', function () {
+ multiSelect.rows([{
+ id: 1
+ }, {
+ id: 2
+ }]);
+
+ multiSelect.selectAll();
+ multiSelect.deselectAll();
+ multiSelect.indetermine(2);
+ expect(multiSelect.togglePage().selected()).toEqual([1, 2]);
+ });
+
it('Select all rows all over the Grid without all rows on current page but with specific rows on another page',
function () {
multiSelect.rows([{
diff --git a/lib/internal/Magento/Framework/File/Mime.php b/lib/internal/Magento/Framework/File/Mime.php
index 148f43d47cfd4..e0b22e4c944d9 100644
--- a/lib/internal/Magento/Framework/File/Mime.php
+++ b/lib/internal/Magento/Framework/File/Mime.php
@@ -108,6 +108,9 @@ public function getMimeType($file)
if (function_exists('mime_content_type')) {
$result = $this->getNativeMimeType($file);
+ } else {
+ $imageInfo = getimagesize($file);
+ $result = $imageInfo['mime'];
}
if (null === $result && isset($this->mimeTypes[$extension])) {
diff --git a/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php b/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php
index 3c571452d7a3e..7a54a7966b500 100644
--- a/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php
+++ b/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php
@@ -58,6 +58,7 @@ public function getMimeTypeDataProvider(): array
'weird extension' => [__DIR__ . '/_files/file.weird', 'application/octet-stream'],
'weird uppercase extension' => [__DIR__ . '/_files/UPPERCASE.WEIRD', 'application/octet-stream'],
'generic mime type' => [__DIR__ . '/_files/blank.html', 'text/html'],
+ 'tmp file mime type' => [__DIR__ . '/_files/magento', 'image/jpeg'],
];
}
}
diff --git a/lib/internal/Magento/Framework/File/Test/Unit/_files/magento b/lib/internal/Magento/Framework/File/Test/Unit/_files/magento
new file mode 100644
index 0000000000000..c377daf8fb0b3
Binary files /dev/null and b/lib/internal/Magento/Framework/File/Test/Unit/_files/magento differ