public function testSetAndGetValueFor() { $ic = new InformationCollector(); $ic->registerRequest(new InformationRequest('foo')); $ic->setValueFor('foo', 'bar'); $this->assertEquals('bar', $ic->getValueFor('foo')); }
protected function loadInformationCollector() { $ic = new InformationCollector(); // Add a specific option if it's the first release $version = $this->getContext()->getVersionPersister()->getCurrentVersion(); if ($version->isInitial()) { $ic->registerRequest(new InformationRequest('confirm-first', array('description' => 'This is the first release for the current branch', 'type' => 'confirmation'))); } // the release task requires the type option $ic->registerStandardRequest('type'); // Register options of all lists (prerequistes and actions) foreach (array('prerequisites', 'preReleaseActions', 'postReleaseActions') as $listName) { foreach ($this->getContext()->getList($listName) as $listItem) { $ic->registerRequests($listItem->getInformationRequests()); } } $this->getContext()->setService('information-collector', $ic); }
protected function loadInformationCollector() { $ic = new InformationCollector(); // Add a specific option if it's the first release try { Context::get('version-persister')->getCurrentVersion(); } catch (\Liip\RMT\Exception\NoReleaseFoundException $e) { $ic->registerRequest(new InformationRequest('confirm-first', array('description' => 'This is the first release for the current branch', 'type' => 'confirmation'))); } catch (\Exception $e) { echo 'Error while trying to read the current version'; } // Register options of the release tasks $ic->registerRequests(Context::get('version-generator')->getInformationRequests()); $ic->registerRequests(Context::get('version-persister')->getInformationRequests()); // Register options of all lists (prerequistes and actions) foreach (array('prerequisites', 'pre-release-actions', 'post-release-actions') as $listName) { foreach (Context::getInstance()->getList($listName) as $listItem) { $ic->registerRequests($listItem->getInformationRequests()); } } Context::getInstance()->setService('information-collector', $ic); }