/** * Execute command and pass control to chained commands * * @param array $itemParams * @return array */ public function execute(array $itemParams = []) { $itemParams = $this->_execute($itemParams); if ($this->_next !== null) { $itemParams = $this->_next->execute($itemParams); } return $itemParams; }
public function testExecuteCallsNextCommandInChain() { $itemParams = array(); $this->_model->expects($this->once())->method('_execute')->with($this->equalTo($itemParams))->will($this->returnValue($itemParams)); $command1 = $this->getMock('Magento\\Backend\\Model\\Menu\\Builder\\Command\\Update', array(), array(array('id' => 1))); $command1->expects($this->once())->method('execute')->with($this->equalTo($itemParams))->will($this->returnValue($itemParams)); $this->_model->chain($command1); $this->assertEquals($itemParams, $this->_model->execute($itemParams)); }
/** * Execute command and pass control to chained commands * * @param array $itemParams * @return array */ public function execute(array $itemParams = array()) { $itemParams = $this->_execute($itemParams); if (!is_null($this->_next)) { $itemParams = $this->_next->execute($itemParams); } return $itemParams; }