From 63e7a20f9835a1c7efe33b1d8da308fd3d27ef1c Mon Sep 17 00:00:00 2001 From: wadedvsa <155439365+wadedvsa@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:02:11 +0000 Subject: [PATCH 1/2] feat: Back to conversations links --- module/Olcs/src/Controller/ConversationsController.php | 2 ++ module/Olcs/view/messages-new.phtml | 8 ++++++++ module/Olcs/view/messages-view.phtml | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/module/Olcs/src/Controller/ConversationsController.php b/module/Olcs/src/Controller/ConversationsController.php index 43f9e86fe..f5b9357a5 100644 --- a/module/Olcs/src/Controller/ConversationsController.php +++ b/module/Olcs/src/Controller/ConversationsController.php @@ -97,6 +97,7 @@ public function addAction(): ViewModel $view = new ViewModel(); $view->setVariable('form', $form); + $view->setVariable('backUrl', $this->url()->fromRoute('conversations')); $view->setTemplate('messages-new'); return $view; @@ -186,6 +187,7 @@ public function viewAction() 'table' => $table, 'form' => $form, 'canReply' => $canReply, + 'backUrl' => $this->url()->fromRoute('conversations'), ], ); $view->setTemplate('messages-view'); diff --git a/module/Olcs/view/messages-new.phtml b/module/Olcs/view/messages-new.phtml index ae6ad7105..7d2462a58 100644 --- a/module/Olcs/view/messages-new.phtml +++ b/module/Olcs/view/messages-new.phtml @@ -20,6 +20,14 @@ echo $this->partial( ->setPartial('partials/tabs-nav'); ?> + + +

translate('Start a new conversation'); ?>

+
formErrors($this->form); diff --git a/module/Olcs/view/messages-view.phtml b/module/Olcs/view/messages-view.phtml index 62ceeac4c..f03f55102 100644 --- a/module/Olcs/view/messages-view.phtml +++ b/module/Olcs/view/messages-view.phtml @@ -20,6 +20,12 @@ echo $this->partial( ->setPartial('partials/tabs-nav'); ?> + + canReply): ?>
From 5e1e2a6a6a82985f3b401944cc1bc254459c5c56 Mon Sep 17 00:00:00 2001 From: wadedvsa <155439365+wadedvsa@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:16:04 +0000 Subject: [PATCH 2/2] fix: Controller unit test --- .../ConversationsControllerTest.php | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test/Olcs/src/Controller/ConversationsControllerTest.php b/test/Olcs/src/Controller/ConversationsControllerTest.php index 87bc2d90f..bd5289053 100644 --- a/test/Olcs/src/Controller/ConversationsControllerTest.php +++ b/test/Olcs/src/Controller/ConversationsControllerTest.php @@ -17,6 +17,7 @@ use Laminas\Http\Response as HttpResponse; use Laminas\Mvc\Controller\Plugin\Params; use Dvsa\Olcs\Transfer\Command\Messaging\Message\Create as CreateMessageCommand; +use Laminas\Mvc\Controller\Plugin\Url; use Laminas\Navigation\Navigation; use Laminas\View\Model\ViewModel; use Mockery as m; @@ -81,13 +82,15 @@ public function testViewAction(): void $mockResponse->shouldReceive('isOk') ->andReturn(true); $mockResponse->shouldReceive('getResult') - ->andReturn([ - 'extra' => [ - 'conversation' => [ - 'isClosed' => true, + ->andReturn( + [ + 'extra' => [ + 'conversation' => [ + 'isClosed' => true, + ], ], ], - ]); + ); $mockHandleQuery = m::mock(HandleQuery::class) ->makePartial(); @@ -107,11 +110,21 @@ public function testViewAction(): void ->with('conversationId') ->andReturn(1); + $mockUrl = m::mock(Url::class); + $mockUrl->shouldReceive('fromRoute') + ->once() + ->with('conversations'); + $this->sut->shouldReceive('params') ->andReturn($this->mockParams); $this->sut->shouldReceive('plugin') ->with('handleQuery') + ->once() ->andReturn($mockHandleQuery); + $this->sut->shouldReceive('plugin') + ->with('url') + ->once() + ->andReturn($mockUrl); $table = '';