/**
  * Update the properties of a given project.
  * @param Project $project
  * @param string $title
  * @param string $type
  * @param string $reference
  * @param array $options
  * @return \PHPCI\Model\Project
  */
 public function updateProject(Project $project, $title, $type, $reference, $options = array())
 {
     // Set basic properties:
     $project->setTitle($title);
     $project->setType($type);
     $project->setReference($reference);
     $project->setAllowPublicStatus(0);
     // Handle extra project options:
     if (array_key_exists('ssh_private_key', $options)) {
         $project->setSshPrivateKey($options['ssh_private_key']);
     }
     if (array_key_exists('ssh_public_key', $options)) {
         $project->setSshPublicKey($options['ssh_public_key']);
     }
     if (array_key_exists('build_config', $options)) {
         $project->setBuildConfig($options['build_config']);
     }
     if (array_key_exists('allow_public_status', $options)) {
         $project->setAllowPublicStatus((int) $options['allow_public_status']);
     }
     if (array_key_exists('archived', $options)) {
         $project->setArchived((bool) $options['archived']);
     }
     if (array_key_exists('branch', $options)) {
         $project->setBranch($options['branch']);
     }
     // Allow certain project types to set access information:
     $this->processAccessInformation($project);
     // Save and return the project:
     return $this->projectStore->save($project);
 }
 public function setUp()
 {
     $project = new Project();
     $project->setId(3);
     $project->setBranch(self::BRANCH);
     $project->setTitle('Test');
     $this->project = $project;
     $this->timezone = date_default_timezone_get();
     date_default_timezone_set('UTC');
 }
Beispiel #3
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());
 }