diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
index 764040e9cfeb..e4ad19592142 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
@@ -132,7 +132,7 @@ public function execute()
$attributesData[$attributeCode] = $value;
} elseif ($attribute->getFrontendInput() == 'multiselect') {
// Check if 'Change' checkbox has been checked by admin for this attribute
- $isChanged = (bool)$this->getRequest()->getPost($attributeCode . '_checkbox');
+ $isChanged = (bool)$this->getRequest()->getPost('toggle_' . $attributeCode);
if (!$isChanged) {
unset($attributesData[$attributeCode]);
continue;
diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php
index b1fbe6aed938..603e566f14fa 100644
--- a/app/code/Magento/Catalog/Model/Product.php
+++ b/app/code/Magento/Catalog/Model/Product.php
@@ -1468,7 +1468,10 @@ public function getMediaGalleryImages()
if (!$this->hasData('media_gallery_images') && is_array($this->getMediaGallery('images'))) {
$images = $this->_collectionFactory->create();
foreach ($this->getMediaGallery('images') as $image) {
- if ((isset($image['disabled']) && $image['disabled']) || empty($image['value_id'])) {
+ if ((isset($image['disabled']) && $image['disabled'])
+ || empty($image['value_id'])
+ || $images->getItemById($image['value_id']) != null
+ ) {
continue;
}
$image['url'] = $this->getMediaConfig()->getMediaUrl($image['file']);
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php
index 10bd9ddfd572..d4950d9df6de 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php
@@ -185,6 +185,16 @@ class ProductTest extends \PHPUnit_Framework_TestCase
*/
private $extensionAttributesFactory;
+ /**
+ * @var \Magento\Framework\Filesystem
+ */
+ private $filesystemMock;
+
+ /**
+ * @var \Magento\Framework\Data\CollectionFactory
+ */
+ private $collectionFactoryMock;
+
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
@@ -374,6 +384,13 @@ protected function setUp()
$this->extensionAttributesFactory = $this->getMockBuilder(ExtensionAttributesFactory::class)
->disableOriginalConstructor()
->getMock();
+ $this->filesystemMock = $this->getMockBuilder(\Magento\Framework\Filesystem::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->collectionFactoryMock = $this->getMockBuilder(\Magento\Framework\Data\CollectionFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
$this->mediaConfig = $this->getMock(\Magento\Catalog\Model\Product\Media\Config::class, [], [], '', false);
$this->objectManagerHelper = new ObjectManagerHelper($this);
@@ -402,6 +419,8 @@ protected function setUp()
'mediaGalleryEntryConverterPool' => $this->mediaGalleryEntryConverterPoolMock,
'linkRepository' => $this->productLinkRepositoryMock,
'catalogProductMediaConfig' => $this->mediaConfig,
+ '_filesystem' => $this->filesystemMock,
+ '_collectionFactory' => $this->collectionFactoryMock,
'data' => ['id' => 1]
]
);
@@ -1230,6 +1249,71 @@ public function testSetMediaGalleryEntries()
$this->assertEquals($expectedResult, $this->model->getMediaGallery());
}
+ public function testGetMediaGalleryImagesMerging()
+ {
+ $mediaEntries = [
+ 'images' => [
+ [
+ 'value_id' => 1,
+ 'file' => 'imageFile.jpg',
+ 'media_type' => 'image',
+ ],
+ [
+ 'value_id' => 1,
+ 'file' => 'imageFile.jpg',
+ ],
+ [
+ 'value_id' => 2,
+ 'file' => 'smallImageFile.jpg',
+ 'media_type' => 'image',
+ ],
+ ]
+ ];
+ $expectedImageDataObject = new \Magento\Framework\DataObject([
+ 'value_id' => 1,
+ 'file' => 'imageFile.jpg',
+ 'media_type' => 'image',
+ 'url' => 'http://magento.dev/pub/imageFile.jpg',
+ 'id' => 1,
+ 'path' => '/var/www/html/pub/imageFile.jpg',
+ ]);
+ $expectedSmallImageDataObject = new \Magento\Framework\DataObject([
+ 'value_id' => 2,
+ 'file' => 'smallImageFile.jpg',
+ 'media_type' => 'image',
+ 'url' => 'http://magento.dev/pub/smallImageFile.jpg',
+ 'id' => 2,
+ 'path' => '/var/www/html/pub/smallImageFile.jpg',
+ ]);
+
+ $directoryMock = $this->getMockBuilder(\Magento\Framework\Filesystem\Directory\ReadInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->filesystemMock->expects($this->once())->method('getDirectoryRead')->willReturn($directoryMock);
+ $this->model->setData('media_gallery', $mediaEntries);
+ $imagesCollectionMock = $this->getMockBuilder(\Magento\Framework\Data\Collection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($imagesCollectionMock);
+ $imagesCollectionMock->expects($this->at(2))->method('getItemById')->with(1)->willReturn($expectedImageDataObject);
+ $this->mediaConfig->expects($this->at(0))
+ ->method('getMediaUrl')
+ ->willReturn('http://magento.dev/pub/imageFile.jpg');
+ $directoryMock->expects($this->at(0))
+ ->method('getAbsolutePath')
+ ->willReturn('/var/www/html/pub/imageFile.jpg');
+ $this->mediaConfig->expects($this->at(2))
+ ->method('getMediaUrl')
+ ->willReturn('http://magento.dev/pub/smallImageFile.jpg');
+ $directoryMock->expects($this->at(1))
+ ->method('getAbsolutePath')
+ ->willReturn('/var/www/html/pub/smallImageFile.jpg');
+ $imagesCollectionMock->expects($this->at(1))->method('addItem')->with($expectedImageDataObject);
+ $imagesCollectionMock->expects($this->at(4))->method('addItem')->with($expectedSmallImageDataObject);
+
+ $this->model->getMediaGalleryImages();
+ }
+
public function testGetCustomAttributes()
{
$priceCode = 'price';
diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php
index 36f3c0711038..6e614545b23d 100644
--- a/app/code/Magento/Newsletter/Model/Subscriber.php
+++ b/app/code/Magento/Newsletter/Model/Subscriber.php
@@ -442,6 +442,7 @@ public function subscribe($email)
$this->setStatusChanged(true);
try {
+ /* Save model before sending out email */
$this->save();
if ($isConfirmNeed === true
&& $isOwnSubscribes === false
diff --git a/app/code/Magento/Search/view/frontend/web/form-mini.js b/app/code/Magento/Search/view/frontend/web/form-mini.js
index 7c9bc4255fb2..9bb254a72476 100644
--- a/app/code/Magento/Search/view/frontend/web/form-mini.js
+++ b/app/code/Magento/Search/view/frontend/web/form-mini.js
@@ -79,6 +79,9 @@ define([
}.bind(this));
this.element.on('blur', $.proxy(function () {
+ if (!this.searchLabel.hasClass('active')) {
+ return;
+ }
setTimeout($.proxy(function () {
if (this.autoComplete.is(':hidden')) {
diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/Block/System/Config/AdminForm.php b/dev/tests/functional/tests/app/Magento/Config/Test/Block/System/Config/AdminForm.php
new file mode 100644
index 000000000000..38bb261cb790
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Config/Test/Block/System/Config/AdminForm.php
@@ -0,0 +1,24 @@
+_rootElement->find($this->adminAccountSharingField, Locator::SELECTOR_CSS)->isVisible();
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/Constraint/AssertAdminAccountSharing.php b/dev/tests/functional/tests/app/Magento/Config/Test/Constraint/AssertAdminAccountSharing.php
new file mode 100644
index 000000000000..ae01915bef39
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Config/Test/Constraint/AssertAdminAccountSharing.php
@@ -0,0 +1,38 @@
+Configuration>advanced>admin grid.
+ */
+class AssertAdminAccountSharing extends AbstractConstraint
+{
+ /**
+ * Assert Admin account sharing is available in Stores>Configuration>advanced>admin grid.
+ * @param AdminAccountSharing $adminAccountSharing
+ */
+ public function processAssert(AdminAccountSharing $adminAccountSharing)
+ {
+ \PHPUnit_Framework_Assert::assertTrue(
+ $adminAccountSharing->getAdminForm()->adminAccountSharingAvailability(),
+ 'Admin Account Sharing Option is not available'
+ );
+ }
+
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return string
+ */
+ public function toString()
+ {
+ return 'Admin Account Sharing option is available and present in Stores>Configuration>Advanced>Admin Grid.';
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/Page/Adminhtml/AdminAccountSharing.xml b/dev/tests/functional/tests/app/Magento/Config/Test/Page/Adminhtml/AdminAccountSharing.xml
new file mode 100644
index 000000000000..0369a7746d52
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Config/Test/Page/Adminhtml/AdminAccountSharing.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php b/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php
new file mode 100644
index 000000000000..30928810490d
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php
@@ -0,0 +1,55 @@
+Configuration>Advanced>admin>Security.
+ * 3. * 7. Verify admin Acoount Sharing option availability.
+ *
+ * @group Config_(PS)
+ * @ZephyrId MAGETWO-47822
+ */
+class VerifyAdminAccountSharingEntityTest extends Injectable
+{
+ /* tags */
+ const MVP = 'yes';
+ const DOMAIN = 'PS';
+ const TEST_TYPE = 'extended_acceptance_test';
+ /* end tags */
+
+ /**
+ * Admin account settings page.
+ *
+ * @var adminAccountSharing
+ */
+ private $adminAccountSharing;
+
+ /**
+ * @param AdminAccountSharing $adminAccountSharing
+ */
+ public function __inject(
+ AdminAccountSharing $adminAccountSharing
+ ) {
+ $this->adminAccountSharing = $adminAccountSharing;
+ }
+
+ /**
+ * Create Verify Admin Account Sharing test.
+ *
+ * @return void
+ */
+ public function test()
+ {
+ $this->adminAccountSharing->open();
+ sleep(10);
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.xml b/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.xml
new file mode 100644
index 000000000000..46b043e6fb5a
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/Block/Adminhtml/Template/Edit/TemplateForm.php b/dev/tests/functional/tests/app/Magento/Email/Test/Block/Adminhtml/Template/Edit/TemplateForm.php
new file mode 100644
index 000000000000..8cd455b6bed8
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Email/Test/Block/Adminhtml/Template/Edit/TemplateForm.php
@@ -0,0 +1,27 @@
+_rootElement->find($this->loadButton, Locator::SELECTOR_CSS); // locate the Load button
+ $element->click(); // click the load button
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/Block/Adminhtml/Template/Edit/TemplateForm.xml b/dev/tests/functional/tests/app/Magento/Email/Test/Block/Adminhtml/Template/Edit/TemplateForm.xml
new file mode 100644
index 000000000000..b8bd0ee922a0
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Email/Test/Block/Adminhtml/Template/Edit/TemplateForm.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ #template_select
+ select
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/Constraint/AssertEmailTemplateSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/Email/Test/Constraint/AssertEmailTemplateSuccessSaveMessage.php
new file mode 100644
index 000000000000..4fbba15df27e
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Email/Test/Constraint/AssertEmailTemplateSuccessSaveMessage.php
@@ -0,0 +1,42 @@
+getMessagesBlock()->getSuccessMessage();
+ \PHPUnit_Framework_Assert::assertEquals(
+ self::SUCCESS_MESSAGE,
+ $actualMessage,
+ 'Wrong success message is displayed.'
+ . "\nExpected: " . self::SUCCESS_MESSAGE
+ . "\nActual: " . $actualMessage
+ );
+ }
+
+ /**
+ * Text success save message is displayed
+ *
+ * @return string
+ */
+ public function toString()
+ {
+ return 'Assert that success message is displayed.';
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/Fixture/EmailTemplate.xml b/dev/tests/functional/tests/app/Magento/Email/Test/Fixture/EmailTemplate.xml
new file mode 100644
index 000000000000..92870a5ebab3
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Email/Test/Fixture/EmailTemplate.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/Page/Adminhtml/EmailTemplateIndex.xml b/dev/tests/functional/tests/app/Magento/Email/Test/Page/Adminhtml/EmailTemplateIndex.xml
new file mode 100644
index 000000000000..dbb64d68dcd9
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Email/Test/Page/Adminhtml/EmailTemplateIndex.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/Page/Adminhtml/EmailTemplateNew.xml b/dev/tests/functional/tests/app/Magento/Email/Test/Page/Adminhtml/EmailTemplateNew.xml
new file mode 100644
index 000000000000..9c0b1a626e13
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Email/Test/Page/Adminhtml/EmailTemplateNew.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.php b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.php
new file mode 100644
index 000000000000..dc86b6479757
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.php
@@ -0,0 +1,77 @@
+emailTemplateIndex = $emailTemplateIndex;
+ $this->emailTemplateNew = $emailTemplateNew;
+ }
+
+ /**
+ * @param EmailTemplate $emailTemplate
+ */
+
+ public function test(EmailTemplate $emailTemplate)
+ {
+ $this->emailTemplateIndex->open();
+ $this->emailTemplateIndex->getPageActionsBlock()->addNew();
+ $this->emailTemplateNew->getTemplateForm()->fill($emailTemplate);
+ $this->emailTemplateNew->getTemplateForm()->clickLoadTemplate();
+ $this->emailTemplateNew->getFormPageActions()->save();
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.xml b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.xml
new file mode 100644
index 000000000000..57b95ad42430
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Change Email
+ Test code_%isolation%
+
+
+
+
\ No newline at end of file