Skip to content

Commit

Permalink
Merge pull request #51 from magento-epam/EPAM-MAGETWO-91620
Browse files Browse the repository at this point in the history
Epam magetwo 91620
  • Loading branch information
vital-pantsialeyeu authored Aug 14, 2018
2 parents 05f9df7 + 279e1f5 commit 8db43e7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function setInAllAttributeSetsFilter(array $setIds)
$setIds
)
->group('entity_attribute.attribute_id')
->having('count = ' . count($setIds));
->having(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds));
}

//$this->getSelect()->distinct(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function testSetInAllAttributeSetsFilter()
$this->selectMock->expects($this->atLeastOnce())->method('group')->with('entity_attribute.attribute_id')
->willReturnSelf();

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

$this->model->setInAllAttributeSetsFilter($setIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ public function testSetAttributeGroupFilter()
$this->assertEquals([$includeGroupId], $groups);
}

/**
* Test if getAllIds method return results after using setInAllAttributeSetsFilter method
*
* @covers \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::setInAllAttributeSetsFilter()
* @covers \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::getAllIds()
*/
public function testSetInAllAttributeSetsFilterWithGetAllIds()
{
$sets = [1];
$this->_model->setInAllAttributeSetsFilter($sets);
$attributeIds = $this->_model->getAllIds();
$this->assertGreaterThan(0, count($attributeIds));
}

/**
* Returns array of group ids, present in collection attributes
*
Expand Down

0 comments on commit 8db43e7

Please sign in to comment.