-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MC-36048: Unexpected behavior of sorting in the Magento Admin Panel
- Loading branch information
OlgaVasyltsun
committed
Aug 7, 2020
1 parent
0d7cf24
commit 663f023
Showing
7 changed files
with
112 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\Framework\Data\Collection"> | ||
<plugin name="currentPageDetection" disabled="true"/> | ||
</type> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\Framework\Data\Collection"> | ||
<plugin name="currentPageDetection" disabled="true"/> | ||
</type> | ||
</config> |
80 changes: 80 additions & 0 deletions
80
...ts/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/CollectionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Catalog\Model\ResourceModel\Attribute; | ||
|
||
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Tests \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection | ||
*/ | ||
class CollectionTest extends TestCase | ||
{ | ||
/** | ||
* @var CollectionFactory . | ||
*/ | ||
private $attributesCollectionFactory; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
$objectManager = Bootstrap::getObjectManager(); | ||
$this->attributesCollectionFactory = $objectManager->get(CollectionFactory::class); | ||
} | ||
|
||
/** | ||
* @magentoAppArea adminhtml | ||
* @dataProvider attributesCollectionGetCurrentPageDataProvider | ||
* | ||
* @param array|null $condition | ||
* @param int $currentPage | ||
* @param int $expectedCurrentPage | ||
* @return void | ||
*/ | ||
public function testAttributesCollectionGetCurrentPage( | ||
?array $condition, | ||
int $currentPage, | ||
int $expectedCurrentPage | ||
): void { | ||
$attributeCollection = $this->attributesCollectionFactory->create(); | ||
$attributeCollection->setCurPage($currentPage)->setPageSize(20); | ||
|
||
if ($condition !== null) { | ||
$attributeCollection->addFieldToFilter('is_global', $condition); | ||
} | ||
|
||
$this->assertEquals($expectedCurrentPage, (int)$attributeCollection->getCurPage()); | ||
} | ||
|
||
/** | ||
* @return array[] | ||
*/ | ||
public function attributesCollectionGetCurrentPageDataProvider(): array | ||
{ | ||
return [ | ||
[ | ||
'condition' => null, | ||
'currentPage' => 1, | ||
'expectedCurrentPage' => 1, | ||
], | ||
[ | ||
'condition' => ['eq' => 0], | ||
'currentPage' => 1, | ||
'expectedCurrentPage' => 1, | ||
], | ||
[ | ||
'condition' => ['eq' => 0], | ||
'currentPage' => 15, | ||
'expectedCurrentPage' => 1, | ||
], | ||
]; | ||
} | ||
} |
663f023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@magento-engcom-team Could some one give description from MC-36048: Unexpected behavior of sorting in the Magento Admin Panel
This PR looks correct but it is also reverting changes from previously #26988
I'm not sure this is correct fix the root cause or workarounds solution with some approach disabled = true
cc: @gabrieldagama @sidolov
663f023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is giving me issues with commands attached to bin/magento. We have a custom reindex where the pagination is going into an infinite loop because it's always returning the FIRST page results.
663f023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't understand this change and have the same issue as @andrewdaluz
663f023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe newer code already updated in 2.4.5. But not sure how effective and solve problem!