public function setUp() { parent::setUp(); $this->head = CommitTest::getStubCommit($this, $this->commitHash, function ($commit) { $commit->gerritChangeId()->once()->return_value($this->changeId); }); }
public function testBadClassNamesIgnored() { $this->shmockAndDieselify('\\Bart\\GitHook\\GitHookConfig', function ($configs) { $configs->getPreReceiveHookActions()->once()->return_value(['\\This\\Class\\DNE']); }, true); $head = CommitTest::getStubCommit($this); $preReceive = new PreReceiveRunner($head); // This should pass with no side effects $preReceive->runAllActions(); }
/** * @dataProvider dataProviderInvalidBuildFixDirectives * @param string $message Git commit message subject */ public function testUnhealthyBuildAndInvalidBuildFixDirectives($message) { $this->mockJenkinsJobWithDependencies(false); $mockCommit = CommitTest::getStubCommit($this, 'HEAD', function ($head) use($message) { $head->messageSubject()->once()->return_value($message); }); $stopTheLineJenkins = new StopTheLineJenkins(); $this->setExpectedException('\\Bart\\GitHook\\GitHookException'); $stopTheLineJenkins->run($mockCommit); }
public function testOneJira() { $this->shmockAndDieselify('\\chobie\\Jira\\Api', function ($jiraClient) { // Expect request to comment on JIRA referenced in commit with // ...the configured template string $jiraClient->addComment('TEST-123', 'merged HEAD')->once(); }, true); $head = CommitTest::getStubCommit($this, 'HEAD', function ($head) { $head->jiras()->once()->return_value([new JiraIssue('TEST-123')]); }); $jiraComment = new JiraComment(); $jiraComment->run($head); }