Example #1
0
 public function testPatterns()
 {
     $dir = getcwd();
     $cerbere = new \Cerbere\Cerbere();
     $cerbere->addParser(new Make());
     $cerbere->addParser(new Info());
     $git = new \Cerbere\Versioning\Git();
     $git->prepare('');
     $directory = $git->getWorkingDirectory();
     $options = array('arguments' => array('q', 'branch' => 'master', 'depth' => 1));
     $git->process('https://github.com/smalot/drush-cerbere.git', $directory, $options);
     chdir($directory);
     $projects = $cerbere->getProjectsFromPatterns(array('*.info'));
     // Todo: review this point.
     $this->array($projects)->hasSize(0);
     //$this->object(reset($projects))->isInstanceOf('\Cerbere\Model\Project');
     // Restore old dir.
     chdir($dir);
 }
Example #2
0
 public function testRun()
 {
     $cerbere = new \Cerbere\Cerbere();
     $cerbere->addParser(new Make());
     $cerbere->addParser(new Info());
     $cache = new FilesystemCache(sys_get_temp_dir() . '/cerbere');
     $action = new Update();
     $action->setCache($cache);
     $versioning = new Git();
     $versioning->setWrapper(new \GitWrapper\GitWrapper());
     $options = array('arguments' => array('q', 'branch' => 'master', 'depth' => 1));
     $job = new Job();
     $job->setVersioning($versioning);
     $job->setAction($action);
     $job->setSource('https://github.com/smalot/drush-cerbere.git', $options);
     $job->setPatterns(array('*.info'));
     $report = $cerbere->run($job);
     $expected = array('cerbere' => array('project' => 'cerbere', 'type' => Project::TYPE_UNKNOWN, 'version' => '', 'version_date' => null, 'recommended' => null, 'dev' => null, 'also_available' => array(), 'status' => -2, 'status_label' => 'Unknown', 'reason' => 'No available releases found'));
     // Todo: review this point.
     $this->array($report)->hasSize(0);
     //->isEqualTo($expected);
     $options = array('arguments' => array('q', 'branch' => 'master', 'depth' => 1));
     $job = new Job();
     $job->setVersioning($versioning);
     $job->setAction($action);
     $job->setSource('https://github.com/smalot/drush-cerbere-XXXXXX.git', $options);
     $job->setPatterns(array('*.info'));
     $this->exception(function () use($cerbere, $job) {
         $cerbere->run($job);
     })->message->contains('XXXXXX');
 }