getProjectName() public method

public getProjectName ( ) : string
return string Name of the repository in which commit was made. This may or may not include the ".git" suffix
コード例 #1
0
ファイル: CodeFreeze.php プロジェクト: box/bart
 /**
  * Run the action
  * @param Commit $commit commit to verify
  * @throws GitHookException if requirement fails
  */
 public function run(Commit $commit)
 {
     $frozenRepos = $this->config->frozenRepoNames();
     if (count($frozenRepos) == 0) {
         $this->logger->debug("No frozen repos.");
         return;
     }
     // Super users are exempt from frozen checks
     // So hope they don't do anything bad by mistake!
     if ($this->isSuperUser()) {
         $this->logger->debug("Superuser exempt from freeze");
         return;
     }
     if ($frozenRepos === ['all']) {
         throw new GitHookException('All repositories are frozen.');
     }
     $project = $commit->getProjectName();
     $this->logger->debug("Validating if {$project} is frozen");
     if (in_array($project, $frozenRepos)) {
         throw new GitHookException("{$project} repository is frozen.");
     }
 }
コード例 #2
0
ファイル: CommitTest.php プロジェクト: box/bart
 public function testCommitProject()
 {
     $commit = new Commit($this->shmock('\\Bart\\Git\\GitRoot', function () {
     }), 'HEAD', 'bart');
     $this->assertEquals('bart', $commit->getProjectName());
 }