/**
  * @group functional
  */
 public function testBuild()
 {
     if (!defined('API_TOKEN')) {
         throw new \RuntimeException('API_TOKEN constant must be defined in phpunit.xml file!');
     }
     $builder = new GithubRepositoryBuilder(API_TOKEN);
     $symfonyRepository = $builder->build('symfony', 'symfony')->getResult();
     $laravelRepository = $builder->build('laravel', 'laravel')->getResult();
     $yii2Repository = $builder->build('yiisoft', 'yii2')->getResult();
     $codeIgniterRepository = $builder->build('bcit-ci', 'CodeIgniter')->getResult();
     // check built repositories
     $this->checkBuiltRepository($symfonyRepository);
     $this->checkBuiltRepository($laravelRepository);
     $this->checkBuiltRepository($yii2Repository);
     $this->checkBuiltRepository($codeIgniterRepository);
     $comparator = new Comparator();
     $result = $comparator->compare([$symfonyRepository, $laravelRepository, $yii2Repository, $codeIgniterRepository]);
     // check results
     $this->assertCount(4, $result);
     foreach ($result as $repository) {
         $this->checkBuiltRepository($repository);
         $this->assertGreaterThan(0, $repository->getWeight());
         $this->assertGreaterThan(0, $repository->getRating());
     }
 }
Beispiel #2
0
 /**
  * @group unit
  * @dataProvider getRepositories
  */
 public function testCompareWithOptions($repo1, $repo2)
 {
     $result = $this->comparator->compare([$repo1, $repo2], ['open_issues' => 1000]);
     $this->assertEquals('second', $result[0]->username);
     $this->assertEquals('first', $result[1]->username);
 }