From f88ae033ff9f021d90808adefce08d5b5d4fec51 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 29 Nov 2017 11:21:55 +0100 Subject: [PATCH] * Infolog: fix new entry with project already set missed it on project tab - Add test for this case --- infolog/inc/class.infolog_ui.inc.php | 2 +- infolog/tests/SetProjectManagerTest.php | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 4bc3634e85..99ff4badbd 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -2031,7 +2031,7 @@ class infolog_ui )); break; case 'projectmanager': - $pm_links = array($action_id); + $content['pm_id'] = $action_id; default: // to allow other apps to participate $content['info_subject'] = Link::title($action, $id); $action_ids = explode(',',$action_id); diff --git a/infolog/tests/SetProjectManagerTest.php b/infolog/tests/SetProjectManagerTest.php index 06320c46b5..840486a85b 100644 --- a/infolog/tests/SetProjectManagerTest.php +++ b/infolog/tests/SetProjectManagerTest.php @@ -437,6 +437,26 @@ class SetProjectManagerTest extends \EGroupware\Api\AppTest $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 * will also clear the project