public function testToJson() { $config = Config::create($this->getConfigData()); $json = $config->toJson(); $this->assertEquals('git', $json->vcs); $this->assertContains('working-copy-check', $json->prerequisites); }
/** * * @param type $generator * @param type $persister * @param type $otherConfig */ protected function createJsonConfig($generator, $persister, $otherConfig = array()) { $helper = new \Liip\RMT\Helpers\ComposerConfig(); $helper->setComposerFile($this->tempDir . '/composer.json'); $allConfig = array_merge($otherConfig, array('versionPersister' => $persister)); $config = \Liip\RMT\Config::create($allConfig); $helper->addRMTConfigSection($config); return $helper->getRMTConfigSection(); }
/** * Returns the data of the RMT config section. * * @return \Liip\RMT\Config|null */ public function getRMTConfigSection() { $json = $this->getJson(); if (!isset($json->extra->rmt)) { return null; } $config = \Liip\RMT\Config::create($json->extra->rmt); return $config; }
/** * Ensures that the rmt config section can be added to the composer file. */ public function testAddRmtConfigSection() { $config = \Liip\RMT\Config::create(array('vcs' => 'git', "prerequisites" => array("working-copy-check", "display-last-changes"), 'versionPersister' => "vcs-tag")); $serialized = $this->helper->addRMTConfigSection($config); $this->assertContains('vcs-tag', $serialized); $config = $this->helper->getRMTConfigSection(); $this->assertNotNull($config); $this->assertEquals('git', $config->getVcs(), var_export($config, true)); }
protected function execute(InputInterface $input, OutputInterface $output) { // Create the executable task inside the project home $this->getOutput()->writeln("Creation of the new executable <info>{$this->executablePath}</info>"); file_put_contents($this->executablePath, "#!/usr/bin/env php\n" . "<?php define('RMT_ROOT_DIR', __DIR__); ?>\n" . "<?php require '{$this->commandPath}'; ?>\n"); exec('chmod +x RMT'); // Create the config file $composerHelper = new \Liip\RMT\Helpers\ComposerConfig(); $composerHelper->setComposerFile($this->configPath); $composerHelper->addRMTConfigSection(\Liip\RMT\Config::create($this->getConfigData())); $this->getOutput()->writeln("Added extra/rmt section to <info>{$this->configPath}</info>"); // Confirmation $this->writeBigTitle('Success, you can start using RMT by calling <info>RMT release</info>'); $this->writeEmptyLine(); }