Exemple #1
0
 public function testAddAndGetItem()
 {
     $origin = 'stock';
     $code = 'cataloginventory';
     $message = Data::ERROR_QTY;
     $additionalData = null;
     $mockItems = [['origin' => $origin, 'code' => $code, 'message' => $message, 'additionalData' => $additionalData]];
     $result = $this->listStatus->addItem($origin, $code, $message, $additionalData);
     $items = $this->listStatus->getItems();
     $this->assertEquals($mockItems, $items);
     $this->assertInstanceOf('\\Magento\\Sales\\Model\\Status\\ListStatus', $result);
 }
Exemple #2
0
 /**
  * Removes error infos, that have parameters equal to passed in $params.
  * $params can have following keys (if not set - then any item is good for this key):
  *   'origin', 'code', 'message'
  *
  * @param array $params
  * @return $this
  */
 public function removeErrorInfosByParams($params)
 {
     $removedItems = $this->_errorInfos->removeItemsByParams($params);
     foreach ($removedItems as $item) {
         if ($item['message'] !== null) {
             $this->removeMessageByText($item['message']);
         }
     }
     if (!$this->_errorInfos->getItems()) {
         $this->_setHasError(false);
     }
     return $this;
 }