protected function assertConfiguration(Configuration $config, $srcDir, array $cloverXml, $jsonPath, $excludeNoStatements = false)
 {
     $this->assertEquals($srcDir, $config->getSrcDir());
     $this->assertEquals($cloverXml, $config->getCloverXmlPaths());
     $this->assertEquals($jsonPath, $config->getJsonPath());
     $this->assertEquals($excludeNoStatements, $config->isExcludeNoStatements());
 }
 /**
  * Create coveralls configuration.
  *
  * @param array  $options Processed configuration.
  * @param string $rootDir Path to project root directory.
  *
  * @return \Satooshi\Bundle\CoverallsV1Bundle\Config\Configuration
  */
 protected function createConfiguration(array $options, $rootDir)
 {
     $configuration = new Configuration();
     $file = new Path();
     $repoToken = $options['repo_token'];
     $repoSecretToken = $options['repo_secret_token'];
     return $configuration->setRepoToken($repoToken !== null ? $repoToken : $repoSecretToken)->setServiceName($options['service_name'])->setSrcDir($this->ensureSrcDir($options['src_dir'], $rootDir, $file))->setCloverXmlPaths($this->ensureCloverXmlPaths($options['coverage_clover'], $rootDir, $file))->setJsonPath($this->ensureJsonPath($options['json_path'], $rootDir, $file))->setExcludeNoStatements($options['exclude_no_stmt']);
 }
Exemple #3
0
 protected function createConfiguration(array $options, $rootDir, InputInterface $input = null)
 {
     $configuration = new Configuration();
     $file = new Path();
     $repoToken = $options['repo_token'];
     $repoSecretToken = $options['repo_secret_token'];
     if ($input !== null && $input->hasOption('coverage_clover') && count($input->getOption('coverage_clover')) > 0) {
         $coverage_clover = $input->getOption('coverage_clover');
     } else {
         $coverage_clover = $options['coverage_clover'];
     }
     return $configuration->setRepoToken($repoToken !== null ? $repoToken : $repoSecretToken)->setServiceName($options['service_name'])->setRootDir($rootDir)->setCloverXmlPaths($this->ensureCloverXmlPaths($coverage_clover, $rootDir, $file))->setJsonPath($this->ensureJsonPath($options['json_path'], $rootDir, $file))->setExcludeNoStatements($options['exclude_no_stmt']);
 }
 public function __construct($paths)
 {
     $rootDir = getcwd();
     $config = new Configuration();
     $config->setRootDir($rootDir);
     $this->setCloverPaths($paths);
     foreach ($this->getCloverPaths() as $path) {
         if (file_exists($path)) {
             $config->addCloverXmlPath($path);
         } else {
             $config->addCloverXmlPath($rootDir . DIRECTORY_SEPARATOR . $path);
         }
     }
     $this->api = new Jobs($config);
 }
Exemple #5
0
 /**
  * Dump submitting json file.
  *
  * @return \Satooshi\Bundle\CoverallsV1Bundle\Repository\JobsRepository
  */
 protected function dumpJsonFile()
 {
     $jsonPath = $this->config->getJsonPath();
     $this->logger->info(sprintf('Dump submitting json file: %s', $jsonPath));
     $this->api->dumpJsonFile();
     $filesize = number_format(filesize($jsonPath) / 1024, 2);
     // kB
     $this->logger->info(sprintf('File size: <info>%s</info> kB', $filesize));
     return $this;
 }
 /**
  * Fill repo_token for unsupported CI service.
  *
  * "COVERALLS_REPO_TOKEN" must be set.
  *
  * @return \Satooshi\Bundle\CoverallsV1Bundle\Collector\CiEnvVarsCollector
  */
 protected function fillRepoToken()
 {
     if ($this->config->hasRepoToken()) {
         $this->env['COVERALLS_REPO_TOKEN'] = $this->config->getRepoToken();
     }
     // backup
     if (isset($this->env['COVERALLS_REPO_TOKEN'])) {
         $this->readEnv['COVERALLS_REPO_TOKEN'] = $this->env['COVERALLS_REPO_TOKEN'];
     }
     return $this;
 }
 protected function createConfiguration()
 {
     $config = new Configuration();
     return $config->addCloverXmlPath($this->cloverXmlPath);
 }