public function testCreateFromArray() { $objectManagerMock = $this->getMock('Magento_ObjectManager', array(), array(), '', false); $objectManagerMock->expects($this->once())->method('create')->with(self::EXPECTED_CLASS_NAME, $this->_arguments, false)->will($this->returnValue(self::CREATE_RESULT)); $factory = new Mage_Index_Model_Process_FileFactory($objectManagerMock); $this->assertEquals(self::CREATE_RESULT, $factory->createFromArray($this->_arguments)); }
/** * Get file handler by process ID * * @param $processId * @return Mage_Index_Model_Process_File */ public function getFile($processId) { if (!isset($this->_fileHandlers[$processId])) { $file = $this->_fileFactory->createFromArray(); $varDirectory = $this->_configuration->getVarDir('locks'); $file->setAllowCreateFolders(true); $file->open(array('path' => $varDirectory)); $fileName = 'index_process_' . $processId . '.lock'; $file->streamOpen($fileName); $file->streamWrite(date('r')); $this->_fileHandlers[$processId] = $file; } return $this->_fileHandlers[$processId]; }