示例#1
0
 private function validateWorkFlow(InputInterface $input, $source, $target)
 {
     if ($input->getOption('ignore-workflow')) {
         $this->getHelper('gush_style')->note('Ignoring merge-workflow.');
         return;
     }
     $config = array_merge(['preset' => 'semver', 'branches' => [], 'unknown_branch_policy' => MergeWorkflowValidator::BRANCH_POLICY_ALLOW], $this->getConfig()->get(['merge_workflow', 'validation'], Config::CONFIG_LOCAL, []));
     $validator = new MergeWorkflowValidator($config['preset'], $config['branches'], $config['unknown_branch_policy']);
     $validator->validate($source, $target);
 }
 public function testBranchRestrictionsDeniesAccessForUnknownBranchWithPolicyDeny()
 {
     $restrictions = ['master' => ['master', 'develop'], 'develop' => ['develop', 'new-feature']];
     $validator = new MergeWorkflowValidator(MergeWorkflowValidator::PRESET_NONE, $restrictions, MergeWorkflowValidator::BRANCH_POLICY_DENY);
     $this->assertTrue($validator->validate('master', 'master'));
     $this->assertTrue($validator->validate('master', 'develop'));
     $this->assertTrue($validator->validate('develop', 'new-feature'));
     $this->setExpectedException('Gush\\Exception\\MergeWorkflowException', 'No branch constraint is set for source "new-feature" and policy denies merging unknown branches.');
     $validator->validate('new-feature', 'develop');
 }