Skip to content

Commit c8808af

Browse files
author
Michael Yu
committed
MAGETWO-71415 [The system grids] Mass actions process only 20 elements from all selected
- Add integration test for mass assign group for 21 customers - Add 21 customers fixture - Fix filter code style
1 parent 718522b commit c8808af

File tree

3 files changed

+457
-3
lines changed

3 files changed

+457
-3
lines changed

app/code/Magento/Ui/Component/MassAction/Filter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,15 @@ private function getFilterIds($limit = true)
223223
if ($this->getDataProvider() instanceof \Magento\Ui\DataProvider\AbstractDataProvider) {
224224
// Use collection's getAllIds for optimization purposes.
225225
$idsArray = $this->getDataProvider()->getAllIds();
226-
}else {
226+
} else {
227227
$searchResult = $this->getDataProvider()->getSearchResult();
228-
if($limit){
228+
if ($limit) {
229229
// Use compatible search api getItems when searchResult is not a collection.
230230
foreach ($searchResult->getItems() as $item) {
231231
/** @var $item \Magento\Framework\Api\Search\DocumentInterface */
232232
$idsArray[] = $item->getId();
233233
}
234-
}else{
234+
} else {
235235
//Grab all selected even if they are not on the current page.
236236
$idsArray = $searchResult->getAllIds();
237237
}

dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,33 @@ public function testMassAssignGroupAction()
6969
$this->assertEquals(0, $customer->getGroupId());
7070
}
7171

72+
/**
73+
* @magentoDataFixture Magento/Customer/_files/twenty_one_customers.php
74+
*/
75+
public function testLargeGroupMassAssignGroupAction()
76+
{
77+
78+
for($i = 1; $i < 22; $i++){
79+
$customer = $this->customerRepository->getById($i);
80+
$this->assertEquals(1, $customer->getGroupId());
81+
}
82+
83+
$this->getRequest()
84+
->setParam('group', 0)
85+
->setPostValue('namespace', 'customer_listing')
86+
->setPostValue('selected', [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]);
87+
$this->dispatch('backend/customer/index/massAssignGroup');
88+
$this->assertSessionMessages(
89+
$this->equalTo(['A total of 21 record(s) were updated.']),
90+
\Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
91+
);
92+
$this->assertRedirect($this->stringStartsWith($this->baseControllerUrl));
93+
for($i = 1; $i < 22; $i++){
94+
$customer = $this->customerRepository->getById($i);
95+
$this->assertEquals(0, $customer->getGroupId());
96+
}
97+
}
98+
7299
/**
73100
* Valid group Id but no customer Ids specified
74101
* @magentoDbIsolation enabled

0 commit comments

Comments
 (0)