protected function execute(InputInterface $input, OutputInterface $output) { $line = $input->getArgument('line'); $file = $this->moodle->directory . '/config.php'; $config = new MoodleConfig(); $contents = $config->read($file); $contents = $config->injectLine($contents, $line); $config->dump($file, $contents); $output->writeln('<info>Updated Moodle config.php file with the following line:</info>'); $output->writeln(['', $line, '']); return $this->lintFile($file, $output); }
/** * @expectedException \RuntimeException */ public function testReadFail() { $fs = new Filesystem(); $fs->dumpFile($this->tempDir . '/test.txt', 'Test'); $fs->chmod($this->tempDir . '/test.txt', 0222); $config = new MoodleConfig(); $config->read($this->tempDir . '/test.txt'); }