/** * @covers PHPUnit::execute */ public function testExecute_TestProjectAccessInformation() { $info = array('item1' => 'Item One', 'item2' => 2); $project = new Project(); $project->setAccessInformation($info); $this->assertEquals('Item One', $project->getAccessInformation('item1')); $this->assertEquals(2, $project->getAccessInformation('item2')); $this->assertNull($project->getAccessInformation('item3')); $this->assertEquals($info, $project->getAccessInformation()); }
/** * 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); } }