Exemplo n.º 1
0
 /**
  * @return \Magento\Rule\Model\Condition\Combine
  */
 protected function getConditions()
 {
     $conditions = $this->getData('conditions_encoded') ? $this->getData('conditions_encoded') : $this->getData('conditions');
     if ($conditions) {
         $conditions = $this->conditionsHelper->decode($conditions);
     }
     $this->rule->loadPost(['conditions' => $conditions]);
     return $this->rule->getConditions();
 }
Exemplo n.º 2
0
 public function testEncodeDecode()
 {
     $value = ['1' => ["type" => "Magento\\CatalogWidget\\Model\\Rule\\Condition\\Combine", "aggregator" => "all", "value" => "1", "new_child" => ""], '1--1' => ["type" => "Magento\\CatalogWidget\\Model\\Rule\\Condition\\Product", "attribute" => "attribute_set_id", "value" => "4", "operator" => "=="], '1--2' => ["type" => "Magento\\CatalogWidget\\Model\\Rule\\Condition\\Product", "attribute" => "category_ids", "value" => "2", "operator" => "=="]];
     $encoded = $this->conditions->encode($value);
     $this->assertEquals($value, $this->conditions->decode($encoded));
 }