public function testCreate()
 {
     $className = 'Magento\\Class';
     $observerMock = $this->getMock('Magento\\Observer', [], [], '', false, false);
     $arguments = ['arg1', 'arg2'];
     $this->objectManagerMock->expects($this->once())->method('create')->with($className, $this->equalTo($arguments))->will($this->returnValue($observerMock));
     $result = $this->observerFactory->create($className, $arguments);
     $this->assertEquals($observerMock, $result);
 }
예제 #2
0
 /**
  * Dispatch event
  *
  * @param array $configuration
  * @param Observer $observer
  * @return void
  */
 public function dispatch(array $configuration, Observer $observer)
 {
     /** Check whether event observer is disabled */
     if (isset($configuration['disabled']) && true === $configuration['disabled']) {
         return;
     }
     if (isset($configuration['shared']) && false === $configuration['shared']) {
         $object = $this->_observerFactory->create($configuration['instance']);
     } else {
         $object = $this->_observerFactory->get($configuration['instance']);
     }
     $this->_callObserverMethod($object, $configuration['method'], $observer);
 }