예제 #1
0
 public function testAddSkippedPathToSettings()
 {
     $settings = SettingsFactory::create();
     $settings->addSkipPath('test-path/');
     $validation = new Validation($settings);
     static::assertFalse($validation->isValidFile('test-path/lol'));
     static::assertTrue($validation->isValidFile('not-test-path/lol'));
 }
예제 #2
0
 public function testInspectThisRespository()
 {
     $settings = SettingsFactory::create();
     $inspector = new Inspector($settings);
     $repository = $inspector->getRepositoryByPath('.');
     static::assertInstanceOf(Repository::class, $repository);
     $results = $inspector->inspectRepository($repository);
     static::assertCount(26, $results['results']);
     static::assertTrue(in_array($results['remote'], ['https://github.com/swisnl/game-of-tests', 'https://github.com/swisnl/game-of-tests.git', 'git@github.com:swisnl/game-of-tests.git', 'git@github.com:swisnl/game-of-tests']), 'Check if remote is correct');
 }
예제 #3
0
 /**
  * @param ParserInterface $parser
  * @param array $expectedFiles What files do we expect as result
  * @param int $expectedCount How many tests should be counted
  */
 protected function runParserTest($parser, $expectedFiles, $expectedCount)
 {
     $settings = SettingsFactory::create();
     $validation = new Result\Validation($settings);
     $results = $parser->run($this->repository, $validation);
     $count = 0;
     foreach ($results as $result) {
         static::assertInstanceOf(Result::class, $result);
         if (in_array($result->getFilename(), $expectedFiles)) {
             $count++;
         }
     }
     static::assertEquals($expectedCount, $count, 'Check if file list has ' . $expectedCount . ' results.');
 }
예제 #4
0
 /**
  * Execute the console command.
  *
  * @return mixed
  * @throws \Gitonomy\Git\Exception\RuntimeException
  * @throws \Gitonomy\Git\Exception\InvalidArgumentException
  */
 public function handle()
 {
     $settings = SettingsFactory::create();
     $inspector = new Inspector($settings);
     $repository = $inspector->getRepositoryByUrl($this->argument('repositoryUrl'));
     $inspectedRepository = $inspector->inspectRepository($repository);
     $header = array_keys((array) $inspectedRepository[key($inspectedRepository)]);
     reset($inspectedRepository['results']);
     array_walk($inspectedRepository['results'], function (&$row) {
         $row = $row->toArray();
     });
     $this->info($inspectedRepository['remote']);
     $this->table($header, $inspectedRepository['results']);
 }
 /**
  * Load config.
  *
  * @return void
  */
 public function register()
 {
     $this->app->instance('Swis\\GoT\\Settings', SettingsFactory::create());
     $this->mergeConfigFrom(__DIR__ . '/../../config/game-of-tests.php', 'game-of-tests');
     $this->commands($this->commands);
 }