예제 #1
0
 public function testIsProcessLockedFalseWithoutUnlock()
 {
     $this->_openFile();
     $this->assertFalse($this->_model->isProcessLocked());
     $this->assertFalse($this->_tryGetSharedLock(), 'File must be locked');
     $this->assertAttributeSame(true, '_streamLocked', $this->_model);
     $this->_model->processUnlock();
 }
예제 #2
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));
 }