Beispiel #1
0
 public function testSafeProcessEventException()
 {
     // prepare mock that throws exception
     /** @var $eventMock Mage_Index_Model_Event */
     $eventMock = $this->getMock('Mage_Index_Model_Event', array('setProcess'), array(), '', false);
     $eventMock->setData($this->_indexerMatchData);
     $exceptionMessage = self::EXCEPTION_MESSAGE;
     $eventMock->expects($this->any())->method('setProcess')->will($this->returnCallback(function () use($exceptionMessage) {
         throw new Exception($exceptionMessage);
     }));
     // can't use @expectedException because we need to assert indexer lock status
     try {
         $this->_model->safeProcessEvent($eventMock);
     } catch (Exception $e) {
         $this->assertEquals(self::EXCEPTION_MESSAGE, $e->getMessage());
     }
     $this->assertFalse($this->_processFile->isProcessLocked(true));
 }