Skip to content

Commit 8db43e7

Browse files
Merge pull request #51 from magento-epam/EPAM-MAGETWO-91620
Epam magetwo 91620
2 parents 05f9df7 + 279e1f5 commit 8db43e7

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function setInAllAttributeSetsFilter(array $setIds)
222222
$setIds
223223
)
224224
->group('entity_attribute.attribute_id')
225-
->having('count = ' . count($setIds));
225+
->having(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds));
226226
}
227227

228228
//$this->getSelect()->distinct(true);

app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/CollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function testSetInAllAttributeSetsFilter()
150150
$this->selectMock->expects($this->atLeastOnce())->method('group')->with('entity_attribute.attribute_id')
151151
->willReturnSelf();
152152

153-
$this->selectMock->expects($this->atLeastOnce())->method('having')->with('count = ' . count($setIds))
153+
$this->selectMock->expects($this->atLeastOnce())->method('having')->with(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds))
154154
->willReturnSelf();
155155

156156
$this->model->setInAllAttributeSetsFilter($setIds);

dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/Entity/Attribute/CollectionTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ public function testSetAttributeGroupFilter()
5252
$this->assertEquals([$includeGroupId], $groups);
5353
}
5454

55+
/**
56+
* Test if getAllIds method return results after using setInAllAttributeSetsFilter method
57+
*
58+
* @covers \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::setInAllAttributeSetsFilter()
59+
* @covers \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::getAllIds()
60+
*/
61+
public function testSetInAllAttributeSetsFilterWithGetAllIds()
62+
{
63+
$sets = [1];
64+
$this->_model->setInAllAttributeSetsFilter($sets);
65+
$attributeIds = $this->_model->getAllIds();
66+
$this->assertGreaterThan(0, count($attributeIds));
67+
}
68+
5569
/**
5670
* Returns array of group ids, present in collection attributes
5771
*

0 commit comments

Comments
 (0)