* Infolog - fix new entry with project already set missed it on project tab

- Add test for this case
This commit is contained in:
nathangray 2017-11-28 09:45:51 -07:00
parent f5401dfade
commit 4724ed2a05
2 changed files with 21 additions and 1 deletions

View File

@ -2031,7 +2031,7 @@ class infolog_ui
)); ));
break; break;
case 'projectmanager': case 'projectmanager':
$pm_links = array($action_id); $content['pm_id'] = $action_id;
default: // to allow other apps to participate default: // to allow other apps to participate
$content['info_subject'] = Link::title($action, $id); $content['info_subject'] = Link::title($action, $id);
$action_ids = explode(',',$action_id); $action_ids = explode(',',$action_id);

View File

@ -437,6 +437,26 @@ class SetProjectManagerTest extends \EGroupware\Api\AppTest
$this->checkElements(0); $this->checkElements(0);
} }
public function testSetProjectViaURL()
{
// Mock the etemplate call to check the results
$this->ui->tmpl->expects($this->once())
->method('exec')
->with($this->stringContains('infolog.infolog_ui.edit'),
$this->callback(function($info) {
$this->assertEquals($this->pm_id, $info['pm_id']);
return $info['pm_id'] == $this->pm_id;
})
);
// Set up the test - set pm_id vi URL
$_REQUEST['action'] = 'projectmanager';
$_REQUEST['action_id'] = $this->pm_id;
// Make a call to edit, looks like pm_id was set, this is initial load
$this->ui->edit();
}
/** /**
* If the contact is set to a project, and the contact is cleared, that * If the contact is set to a project, and the contact is cleared, that
* will also clear the project * will also clear the project