public function testGetProcessFile() { $this->_processFile = $this->getMock('Magento\\Index\\Model\\Process\\File', array(), array(), '', false, false); $this->_prepareIndexProcess(); // assert that process file is stored in process entity instance and isn't changed after several invocations // lock method is used as invocation of _getProcessFile for ($i = 1; $i <= 2; $i++) { $this->_indexProcess->lock(); $this->assertAttributeEquals($this->_processFile, '_processFile', $this->_indexProcess); } }
public function testUnlockFailed() { $this->mutex->expects($this->exactly(2))->method('getConnection')->will($this->returnValue($this->pdo)); $this->pdo->expects($this->at(0))->method('prepare')->will($this->returnValue($this->stmtGetLock)); $this->pdo->expects($this->at(1))->method('prepare')->will($this->returnValue($this->stmtReleaseLock)); // Valid lock $this->stmtGetLock->expects($this->once())->method('fetchColumn')->will($this->returnValue(1)); $this->mutex->lock(); // Invalid unlock $this->stmtReleaseLock->expects($this->once())->method('fetchColumn')->will($this->returnValue(0)); $result = $this->mutex->unlock(); $this->assertEquals(false, $result); }