diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.php
index 4a1ba08b8565e73dd84123bdd8f363c5b5cd794f..fb1cb5d63a3a551430bcbdf0bc1f6b8d1046c4a2 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.php
@@ -7,30 +7,32 @@
namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit;
use Magento\Backend\Test\Block\Widget\FormTabs;
+use Magento\Mtf\Client\Element\SimpleElement;
+use Magento\Mtf\Client\Locator;
use Magento\Mtf\Factory\Factory;
+use Magento\Mtf\Fixture\FixtureInterface;
/**
- * Class CategoryForm
- * Category container block
+ * Category container block.
*/
class CategoryForm extends FormTabs
{
/**
- * Save button
+ * Default sore switcher block locator.
*
* @var string
*/
- protected $saveButton = '[data-ui-id=category-edit-form-save-button]';
+ protected $storeSwitcherBlock = '.store-switcher';
/**
- * Category Products grid
+ * Dropdown block locator.
*
* @var string
*/
- protected $productsGridBlock = '#catalog_category_products';
+ protected $dropdownBlock = '.dropdown';
/**
- * Get Category edit form
+ * Get Category edit form.
*
* @return \Magento\Catalog\Test\Block\Adminhtml\Category\Tab\ProductGrid
*/
@@ -40,4 +42,25 @@ class CategoryForm extends FormTabs
$this->_rootElement->find($this->productsGridBlock)
);
}
+
+ /**
+ * Fill form with tabs.
+ *
+ * @param FixtureInterface $fixture
+ * @param SimpleElement|null $element
+ * @return FormTabs
+ */
+ public function fill(FixtureInterface $fixture, SimpleElement $element = null)
+ {
+ $tabs = $this->getFieldsByTabs($fixture);
+ if ($fixture->hasData('store_id')) {
+ $store = $fixture->getStoreId();
+ $storeSwitcherBlock = $this->browser->find($this->storeSwitcherBlock);
+ $storeSwitcherBlock->find($this->dropdownBlock, Locator::SELECTOR_CSS, 'liselectstore')->setValue($store);
+ $this->browser->acceptAlert();
+
+ }
+
+ return $this->fillTabs($tabs, $element);
+ }
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php
index 4c34c902a1689508e77de4266a8a323c31ba2f13..4389411c00650ec202aa49418c3d2d22f3f85eb6 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php
@@ -9,8 +9,7 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit;
use Magento\Backend\Test\Block\FormPageActions;
/**
- * Class PageActions
- * Category page actions
+ * Category page actions.
*/
class PageActions extends FormPageActions
{
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryWithCustomStoreOnFrontend.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryWithCustomStoreOnFrontend.php
new file mode 100644
index 0000000000000000000000000000000000000000..a448fcaa3f18d9e6fe8e70bb1c71f1ae0ba185a0
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryWithCustomStoreOnFrontend.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Catalog\Test\Constraint;
+
+use Magento\Catalog\Test\Fixture\Category;
+use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
+use Magento\Mtf\Client\BrowserInterface;
+use Magento\Mtf\Constraint\AbstractConstraint;
+use Magento\Cms\Test\Page\CmsIndex;
+
+/**
+ * Assert that category name is different on different store view.
+ */
+class AssertCategoryWithCustomStoreOnFrontend extends AbstractConstraint
+{
+ /**
+ * Assert that category name is different on different store view.
+ *
+ * @param BrowserInterface $browser
+ * @param CatalogCategoryView $categoryView
+ * @param Category $category
+ * @param Category $initialCategory
+ * @param CmsIndex $cmsIndex
+ * @return void
+ */
+ public function processAssert(
+ BrowserInterface $browser,
+ CatalogCategoryView $categoryView,
+ Category $category,
+ Category $initialCategory,
+ CmsIndex $cmsIndex
+ ) {
+ $cmsIndex->open();
+ $cmsIndex->getLinksBlock()->waitWelcomeMessage();
+ $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
+ \PHPUnit_Framework_Assert::assertEquals(
+ $initialCategory->getName(),
+ $categoryView->getTitleBlock()->getTitle(),
+ 'Wrong category name is displayed for default store.'
+ );
+
+ $store = $category->getDataFieldConfig('store_id')['source']->store->getName();
+ $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store);
+ $cmsIndex->getLinksBlock()->waitWelcomeMessage();
+ $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
+ \PHPUnit_Framework_Assert::assertEquals(
+ $category->getName(),
+ $categoryView->getTitleBlock()->getTitle(),
+ 'Wrong category name is displayed for ' . $store
+ );
+ }
+
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return string
+ */
+ public function toString()
+ {
+ return 'Category name is different on different store view.';
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml
index 2c5e23a9099b79bee01f5aee1d92ff8440029b1c..975ae3ed0e70dfaaed4f4fcbd69acbd541c840a5 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml
@@ -41,5 +41,6 @@
<field name="landing_page" group="display_setting" source="Magento\Catalog\Test\Fixture\Category\LandingPage" />
<field name="display_mode" group="display_setting" />
<field name="category_products" group="category_products" source="Magento\Catalog\Test\Fixture\Category\CategoryProducts" />
+ <field name="store_id" group="null" source="Magento\Catalog\Test\Fixture\Category\StoreId" />
</fixture>
</config>
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/StoreId.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/StoreId.php
new file mode 100644
index 0000000000000000000000000000000000000000..981a7499f5835e004a5981db6c91cc15ffd3df40
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/StoreId.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Catalog\Test\Fixture\Category;
+
+use Magento\Mtf\Fixture\DataSource;
+use Magento\Mtf\Fixture\FixtureFactory;
+use Magento\Store\Test\Fixture\Store;
+use Magento\Store\Test\Fixture\StoreGroup;
+
+/**
+ * Category store id scope.
+ */
+class StoreId extends DataSource
+{
+ /**
+ * Store fixture.
+ *
+ * @var Store
+ */
+ public $store;
+
+ /**
+ * @constructor
+ * @param FixtureFactory $fixtureFactory
+ * @param array $params
+ * @param array $data [optional]
+ */
+ public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
+ {
+ $this->params = $params;
+
+ if (isset($data['dataset'])) {
+ $store = $fixtureFactory->createByCode('store', $data);
+ /** @var Store $store */
+ if (!$store->getStoreId()) {
+ $store->persist();
+ }
+ $this->store = $store;
+ $this->data = $store->getGroupId() . '/' . $store->getName();
+ } else {
+ $this->data = $data;
+ }
+ }
+
+ /**
+ * Return Store fixture.
+ *
+ * @return Store
+ */
+ public function getStore()
+ {
+ return $this->store;
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml
index 2c108c67f39758a85b6b8aaff63250f3ca6b1e8d..a28b5e16ab25d676e779dfc30d46ea93ad2393f2 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml
@@ -46,5 +46,11 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" />
<constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" />
</variation>
+ <variation name="UpdateCategoryEntityTestVariation4" summary="Update Category with custom Store View.">
+ <data name="category/data/store_id/dataset" xsi:type="string">custom</data>
+ <data name="category/data/name" xsi:type="string">Category %isolation%</data>
+ <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" />
+ <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryWithCustomStoreOnFrontend" />
+ </variation>
</testCase>
</config>
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml
index c02f461a875785a48b4312fcd154f2ac302b6e85..92c41c11a06ef9e15ec3f1f2fa85775387f59ee3 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml
@@ -151,4 +151,9 @@
<argument name="severity" xsi:type="string">high</argument>
</arguments>
</type>
+ <type name="Magento\Catalog\Test\Constraint\AssertCategoryWithCustomStoreOnFrontend">
+ <arguments>
+ <argument name="severity" xsi:type="string">low</argument>
+ </arguments>
+ </type>
</config>