public function testCollectValidatedAttributes()
 {
     $collection = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection')->disableOriginalConstructor()->getMock();
     $condition = $this->getMockBuilder('Magento\\CatalogWidget\\Model\\Rule\\Condition\\Combine')->disableOriginalConstructor()->setMethods(['addToCollection'])->getMock();
     $condition->expects($this->any())->method('addToCollection')->with($collection)->will($this->returnSelf());
     $this->condition->setConditions([$condition]);
     $this->assertSame($this->condition, $this->condition->collectValidatedAttributes($collection));
 }
Esempio n. 2
0
 public function testCollectValidatedAttributes()
 {
     $collection = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection')->disableOriginalConstructor()->setMethods(['getSelect'])->getMock();
     $select = $this->getMockBuilder('\\Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->setMethods(['getPart'])->getMock();
     $select->expects($this->any())->method('getPart')->with('from')->willReturn(['alias_table' => 'table_name']);
     $collection->expects($this->any())->method('getSelect')->willReturn($select);
     $condition = $this->getMockBuilder('Magento\\CatalogWidget\\Model\\Rule\\Condition\\Combine')->disableOriginalConstructor()->setMethods(['addToCollection'])->getMock();
     $condition->expects($this->any())->method('addToCollection')->with($collection)->will($this->returnSelf());
     $this->condition->setConditions([$condition]);
     $this->assertSame($this->condition, $this->condition->collectValidatedAttributes($collection));
 }