Skip to content

Commit 8604cce

Browse files
committed
MTO-121: [Variation] Move Anchored Category with Products
- Defects fixed
1 parent 5211452 commit 8604cce

File tree

6 files changed

+28
-24
lines changed

6 files changed

+28
-24
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Tree extends Block
6565
*
6666
* @var string
6767
*/
68-
protected $categoryInTree = '//ul//li//span[contains(text(), "%s")]';
68+
private $categoryInTree = '//ul//li//span[contains(text(), "%s")]';
6969

7070
/**
7171
* Get backend abstract block.

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryNavigationMenu.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@
1616
class AssertCategoryNavigationMenu extends AbstractConstraint
1717
{
1818
/**
19-
* Array for category tree.
19+
* Default category name.
20+
*/
21+
const DEFAULT_CATEGORY_NAME = 'Default Category';
22+
23+
/**
24+
* List of nested categories names.
2025
*
2126
* @var array
2227
*/
23-
private $categoryTree = [];
28+
private $nestedCategoriesList = [];
2429

2530
/**
2631
* Assert that relations of categories in navigation menu are correct.
@@ -37,25 +42,24 @@ public function processAssert(
3742
Category $childCategory,
3843
Category $parentCategory
3944
) {
40-
4145
do {
4246
$name = $bottomChildCategory->getName();
4347
if ($name !== $childCategory->getName()) {
44-
$this->categoryTree[] = $name;
48+
$this->nestedCategoriesList[] = $name;
4549
$bottomChildCategory = $bottomChildCategory->getDataFieldConfig('parent_id')['source']
4650
->getParentCategory();
4751
} else {
48-
$this->categoryTree[] = $childCategory->getName();
52+
$this->nestedCategoriesList[] = $childCategory->getName();
4953
break;
5054
}
5155
} while ($name);
5256

53-
if ($parentCategory->getName() !== 'Default Category') {
54-
$this->categoryTree[] = $parentCategory->getName();
57+
if ($parentCategory->getName() !== self::DEFAULT_CATEGORY_NAME) {
58+
$this->nestedCategoriesList[] = $parentCategory->getName();
5559
}
5660
$cmsIndex->open();
5761

58-
foreach (array_reverse($this->categoryTree) as $category) {
62+
foreach (array_reverse($this->nestedCategoriesList) as $category) {
5963
$cmsIndex->getTopMenu()->hoverCategoryByName($category);
6064
\PHPUnit_Framework_Assert::assertTrue(
6165
$cmsIndex->getTopMenu()->isCategoryVisible($category),
@@ -71,6 +75,6 @@ public function processAssert(
7175
*/
7276
public function toString()
7377
{
74-
return 'Topmenu contains correct tree of categories';
78+
return 'Topmenu contains correct tree of categories.';
7579
}
7680
}

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/MoveCategoryEntityTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ public function __inject(
6666
*
6767
* @param Category $childCategory
6868
* @param Category $parentCategory
69-
* @param array|null $moveLevel
69+
* @param array $moveLevel
7070
* @return array
7171
*/
72-
public function test(Category $childCategory, Category $parentCategory, array $moveLevel = null)
72+
public function test(Category $childCategory, Category $parentCategory, array $moveLevel = [])
7373
{
7474
// Preconditions:
7575
$parentCategory->persist();
7676
$childCategory->persist();
7777
$bottomChildCategory = $childCategory;
7878

79-
if ($moveLevel !== null) {
79+
if (!empty($moveLevel)) {
8080
for ($nestingIterator = 1; $nestingIterator < $moveLevel['child']; $nestingIterator++) {
8181
$childCategory = $childCategory->getDataFieldConfig('parent_id')['source']->getParentCategory();
8282
}

dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/Block/Navigation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ class Navigation extends Block
5555
*
5656
* @var string
5757
*/
58-
protected $categoryName = './/li[@class="item"]//a[contains(text(),"%s")]';
58+
private $categoryName = './/li[@class="item"]//a[contains(text(),"%s")]';
5959

6060
/**
6161
* Locator for element with product quantity.
6262
*
6363
* @var string
6464
*/
65-
protected $productQty = '/following-sibling::span[contains(text(), "%s")]';
65+
private $productQty = '/following-sibling::span[contains(text(), "%s")]';
6666

6767
/**
6868
* Remove all applied filters.

dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/Constraint/AssertCategoryLayeredNavigation.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace Magento\LayeredNavigation\Test\Constraint;
88

99
use Magento\Mtf\Client\BrowserInterface;
10-
use Magento\Mtf\Fixture\FixtureInterface;
1110
use Magento\Catalog\Test\Fixture\Category;
1211
use Magento\Mtf\Constraint\AbstractConstraint;
1312
use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
@@ -22,7 +21,7 @@ class AssertCategoryLayeredNavigation extends AbstractConstraint
2221
*
2322
* @var BrowserInterface
2423
*/
25-
protected $browser;
24+
private $browser;
2625

2726
/**
2827
* Assert that category is present in layered navigation and product is visible in product grid.
@@ -63,7 +62,7 @@ public function processAssert(
6362
* @param Category $category
6463
* @return void
6564
*/
66-
protected function openCategory(Category $category)
65+
private function openCategory(Category $category)
6766
{
6867
$categoryUrlKey = [];
6968

dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Topmenu.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
use Magento\Mtf\Client\Locator;
1111

1212
/**
13-
* Class top menu navigation block.
13+
* Class Topmenu
14+
* Class top menu navigation block
1415
*/
1516
class Topmenu extends Block
1617
{
@@ -43,7 +44,7 @@ class Topmenu extends Block
4344
protected $navigationMenuItems = "/li";
4445

4546
/**
46-
* Select category from top menu by name and click on it.
47+
* Select category from top menu by name and click on it
4748
*
4849
* @param string $categoryName
4950
* @return void
@@ -61,7 +62,7 @@ function () use ($category) {
6162
}
6263
$category[0]->click();
6364
}
64-
65+
6566
/**
6667
* Hover on category from top menu by name.
6768
*
@@ -83,7 +84,7 @@ function () use ($category) {
8384
}
8485

8586
/**
86-
* Check is visible category in top menu by name.
87+
* Check is visible category in top menu by name
8788
*
8889
* @param string $categoryName
8990
* @return bool
@@ -94,7 +95,7 @@ public function isCategoryVisible($categoryName)
9495
}
9596

9697
/**
97-
* Wait for load top menu.
98+
* Wait for load top menu
9899
*
99100
* @param string $categoryName
100101
* @return array
@@ -119,7 +120,7 @@ function () use ($rootElement, $moreCategoriesLink, $submenu) {
119120
}
120121

121122
/**
122-
* Check menu items count.
123+
* Check menu items count
123124
*
124125
* @param int $number
125126
* @return bool

0 commit comments

Comments
 (0)