Пример #1
0
 /**
  * @test
  */
 public function shouldBeAbleToRunCsFixForAPackage()
 {
     $before = $this->getFileMD5($this->fileToFix);
     $package = new LocalPackage(array(), $this->fileToFix, new Package());
     $command = new ExecuteCSFixer($this->csFixBin(), 100, $this->mockEventDispatcher());
     $this->assertEquals(1, $command->execute($package));
     $after = $this->getFileMD5($this->fileToFix);
     $this->assertNotEquals($before, $after);
 }
Пример #2
0
 public function execute(Package $package, $dryRun = false)
 {
     $client = $this->getAuthenticateGitHubClient();
     $gitWrapper = $this->getGitWrapper();
     $step = new Step\ForkPackage($client, $this->dispatcher);
     $repository = $step->execute($package);
     sleep(180);
     $localPackage = new LocalPackage($repository, $this->sanitizeLocallyDir($package), $package);
     $step = new Step\CloneLocally($gitWrapper, $this->dispatcher);
     $step->execute($localPackage);
     $step = new Step\ExecuteCSFixer($this->phpCsFixerBin, 4000, $this->dispatcher);
     $step->execute($localPackage);
     if (!$dryRun) {
         $step = new Step\CommitAndPush($this->dispatcher);
         $git = $this->getGitWorking($gitWrapper, $localPackage);
         $step->execute($git, $localPackage);
         $step = new Step\MakeAPR($client, new FunnyMessageRepository(), $this->dispatcher);
         $step->execute($localPackage);
     }
     return $localPackage;
 }