File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
app/code/Magento/CatalogWidget
Test/Unit/Model/Rule/Condition Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,9 @@ public function getNewChildSelectOptions()
71
71
*/
72
72
public function collectValidatedAttributes ($ productCollection )
73
73
{
74
+ $ alias = array_keys ($ productCollection ->getSelect ()->getPart ('from ' ))[0 ];
74
75
foreach ($ this ->getConditions () as $ condition ) {
76
+ $ condition ->setData ('attribute ' , $ alias . '. ' . $ condition ->getData ('attribute ' ));
75
77
$ condition ->addToCollection ($ productCollection );
76
78
}
77
79
return $ this ;
Original file line number Diff line number Diff line change @@ -73,8 +73,13 @@ public function testGetNewChildSelectOptions()
73
73
public function testCollectValidatedAttributes ()
74
74
{
75
75
$ collection = $ this ->getMockBuilder ('\Magento\Catalog\Model\ResourceModel\Product\Collection ' )
76
- ->disableOriginalConstructor ()
76
+ ->disableOriginalConstructor ()->setMethods (['getSelect ' ])
77
+ ->getMock ();
78
+ $ select = $ this ->getMockBuilder ('\Magento\Framework\DB\Select ' )
79
+ ->disableOriginalConstructor ()->setMethods (['getPart ' ])
77
80
->getMock ();
81
+ $ select ->expects ($ this ->any ())->method ('getPart ' )->with ('from ' )->willReturn (['alias_table ' => 'table_name ' ]);
82
+ $ collection ->expects ($ this ->any ())->method ('getSelect ' )->willReturn ($ select );
78
83
$ condition = $ this ->getMockBuilder ('Magento\CatalogWidget\Model\Rule\Condition\Combine ' )
79
84
->disableOriginalConstructor ()->setMethods (['addToCollection ' ])
80
85
->getMock ();
You can’t perform that action at this time.
0 commit comments