public function testMustRun() { $helper = new ProcessHelper(); $helper->setHelperSet(new HelperSet([new DebugFormatterHelper()])); $execute = new Execute(new NullOutput(), $helper); $process = $execute->mustRun('php -r "echo 42;"'); $this->assertInstanceOf('Symfony\\Component\\Process\\Process', $process); $this->assertTrue($process->isSuccessful()); }
public function install() { $this->getOutput()->step('Cloning Moodle'); $process = new Process(sprintf('git clone --depth=1 --branch %s git://github.com/moodle/moodle %s', $this->branch, $this->moodle->directory)); $process->setTimeout(null); $this->execute->mustRun($process); // Expand the path to Moodle so all other installers use absolute path. $this->moodle->directory = $this->expandPath($this->moodle->directory); $this->getOutput()->step('Moodle assets'); $this->getOutput()->debug('Creating Moodle data directories'); $filesystem = new Filesystem(); $filesystem->mkdir($this->dataDir); $filesystem->mkdir($this->dataDir . '/phpu_moodledata'); $filesystem->mkdir($this->dataDir . '/behat_moodledata'); $this->getOutput()->debug('Create Moodle database'); $this->execute->mustRun($this->database->getCreateDatabaseCommand()); $this->getOutput()->debug('Creating Moodle\'s config file'); $contents = $this->config->createContents($this->database, $this->expandPath($this->dataDir)); $this->config->dump($this->moodle->directory . '/config.php', $contents); $this->addEnv('MOODLE_DIR', $this->moodle->directory); }