public function sendReceive_commitProject() { return SendReceiveCommands::startLFMergeIfRequired($this->projectId); }
public function testStartLFMergeIfRequired_HasSendReceiveButNoPidFile_Started() { $project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE); $project->sendReceiveProjectIdentifier = 'sr_id'; $project->sendReceiveProject = new SendReceiveProjectModel('sr_name', '', 'manager'); $projectId = $project->write(); $mockPidFilePath = sys_get_temp_dir() . '/mockLFMerge.pid'; $runSeconds = 2; $mockCommand = 'php ' . __DIR__ . '/mockLFMergeExe.php ' . $runSeconds; $isRunning = SendReceiveCommands::startLFMergeIfRequired($projectId, $mockPidFilePath, $mockCommand); $this->assertTrue($isRunning); sleep(1); $this->assertTrue(SendReceiveCommands::isProcessRunningByPidFile($mockPidFilePath)); $isStillRunning = SendReceiveCommands::startLFMergeIfRequired($projectId, $mockPidFilePath, $mockCommand); $this->assertTrue($isStillRunning); }