/**
  * Handle the analyze branch command.
  *
  * @param \StyleCI\StyleCI\Commands\Analysis\AnalyzeBranchCommand $command
  *
  * @return void
  */
 public function handle(AnalyzeBranchCommand $command)
 {
     $repo = $command->repo;
     $branch = $command->branch;
     $commit = $this->branches->getCommit($repo, $branch);
     $message = Str::commit($this->commits->get($repo, $commit)['commit']['message']);
     $analysis = Analysis::create(['repo_id' => $repo->id, 'branch' => $branch, 'commit' => $commit, 'message' => $message, 'status' => Analysis::PENDING, 'hidden' => false]);
     $this->dispatch(new RunAnalysisJob($analysis));
 }
示例#2
0
 public function testPresentation()
 {
     $analysis = Analysis::create(['repo_id' => 12345, 'branch' => 'test', 'commit' => str_repeat('a', 40), 'message' => 'Test 123!', 'status' => 2, 'hidden' => 1]);
     $presented = AutoPresenter::decorate($analysis);
     $this->assertInstanceOf(AnalysisPresenter::class, $presented);
     $this->assertSame('xkXG8Z', $presented->id);
     $this->assertSame('PASSED', $presented->summary);
     $this->assertSame('The StyleCI analysis has passed', $presented->description);
     $this->assertSame('fa fa-check-circle', $presented->icon);
     $this->assertSame('green', $presented->color);
     $this->assertFalse($presented->has_diff);
 }
 /**
  * Handle the analyze commit command.
  *
  * @param \StyleCI\StyleCI\Commands\Analysis\AnalyzeCommitCommand $command
  *
  * @return void
  */
 public function handle(AnalyzeCommitCommand $command)
 {
     $analysis = Analysis::create(['repo_id' => $command->repo->id, 'branch' => $command->branch, 'commit' => $command->commit, 'message' => $command->message, 'status' => Analysis::PENDING, 'hidden' => false]);
     dispatch(new RunAnalysisJob($analysis));
 }
 /**
  * Handle the analyze pull request command.
  *
  * @param \StyleCI\StyleCI\Commands\Analysis\AnalyzePullRequestCommand $command
  *
  * @return void
  */
 public function handle(AnalyzePullRequestCommand $command)
 {
     $analysis = Analysis::create(['repo_id' => $command->repo->id, 'pr' => $command->pr, 'commit' => $command->commit, 'message' => $command->message, 'status' => Analysis::PENDING, 'hidden' => false]);
     $this->dispatch(new RunAnalysisJob($analysis));
 }