Example #1
0
 /**
  * Test the config validaton
  *
  * @param  string $sFile
  * @param  mixed $mException
  *
  * @dataProvider validateProvider
  */
 public function testValidate($sFile, $mException = null)
 {
     $mResult = null;
     try {
         $oConfig = new \Testy\Config($sFile);
         $oConfig->validate();
     } catch (\Testy\Exception $e) {
         $mResult = $e->getMessage();
     }
     $this->assertEquals($mException, $mResult);
 }
Example #2
0
 /**
  * Executes the current command.
  *
  * @param  InputInterface $input An InputInterface instance
  * @param  OutputInterface $output An OutputInterface instance
  *
  * @return null|integer null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $oConfig = new \Testy\Config($input->getOption('config'));
         $oConfig->validate();
         $bFirstRun = true;
         $oWatch = new \Testy\Watch();
         while (true) {
             $oRawConfig = $oConfig->get();
             if ($bFirstRun === true or $oConfig->wasUpdated() === true) {
                 $aNotifiers = array();
                 foreach ($oRawConfig->setup->notifiers as $sNotifier => $oNotifierConfig) {
                     if (isset($oNotifierConfig->enabled) === true and $oNotifierConfig->enabled == true) {
                         $aNotifiers[$sNotifier] = \notifyy\Builder::build($sNotifier, $oNotifierConfig);
                     }
                 }
                 foreach ($oRawConfig->projects as $sProject => $oProjectConfig) {
                     $oWatch->add(\Testy\Project\Builder::build($sProject, $oProjectConfig, $aNotifiers));
                 }
             }
             $oWatch->loop($oRawConfig->setup->parallel, $oRawConfig->setup->sleep);
             sleep($oRawConfig->setup->sleep);
             $bFirstRun = false;
         }
     } catch (\Testy\Exception $e) {
         $output->writeln($e->getMessage());
         return 1;
     }
     return null;
 }