Example #1
0
 /**
  * @covers PHPUnit::execute
  */
 public function testExecute_UpdateExistingProject()
 {
     $project = new Project();
     $project->setTitle('Before Title');
     $project->setReference('Before Reference');
     $project->setType('github');
     $returnValue = $this->testedService->updateProject($project, 'After Title', 'bitbucket', 'After Reference');
     $this->assertEquals('After Title', $returnValue->getTitle());
     $this->assertEquals('After Reference', $returnValue->getReference());
     $this->assertEquals('bitbucket', $returnValue->getType());
 }
Example #2
0
 /**
  * In circumstances where it is necessary, populate access information based on other project properties.
  * @see ProjectService::createProject()
  * @param Project $project
  */
 protected function processAccessInformation(Project &$project)
 {
     $matches = array();
     $reference = $project->getReference();
     if ($project->getType() == 'gitlab') {
         $info = array();
         if (preg_match('`^(.+)@(.+):([0-9]*)\\/?(.+)\\.git`', $reference, $matches)) {
             $info['user'] = $matches[1];
             $info['domain'] = $matches[2];
             $info['port'] = $matches[3];
             $project->setReference($matches[4]);
         }
         $project->setAccessInformation($info);
     }
 }