Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

fix: VOL-5103 update selfserve type of licence controller as it shares the updated controller from common #80

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Common\FormService\Form\Lva\ConvictionsPenalties;
use Common\FormService\FormServiceManager;
use Common\Rbac\Service\Permission;
use Common\Service\Helper\FormHelperService;
use Common\Service\Helper\GuidanceHelperService;
use Common\Service\Helper\TranslationHelperService;
Expand Down Expand Up @@ -138,11 +139,10 @@ public function __invoke($container, $requestedName, array $options = null)
$formServiceLocator = $serviceLocator->get(FormServiceManager::class);
return new VariationTypeOfLicence($formHelper, $authService, $formServiceLocator);
case self::FORM_SERVICE_CLASS_ALIASES['lva-application-type_of_licence']:
$authService = $serviceLocator->get(AuthorizationService::class);
$permissionService = $serviceLocator->get(Permission::class);
$guidanceHelper = $serviceLocator->get(GuidanceHelperService::class);
$formServiceLocator = $serviceLocator->get(FormServiceManager::class);
return new ApplicationTypeOfLicence($formHelper, $authService, $guidanceHelper, $formServiceLocator);

return new ApplicationTypeOfLicence($formHelper, $permissionService, $guidanceHelper, $formServiceLocator);
// Address
case self::FORM_SERVICE_CLASS_ALIASES['lva-licence-addresses']:
return new LicenceAddresses($formHelper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,26 @@

use Common\FormService\Form\Lva\TypeOfLicence\ApplicationTypeOfLicence as CommonLicenceTypeOfLicence;
use Common\FormService\FormServiceManager;
use Common\Rbac\Service\Permission;
use Common\Service\Helper\FormHelperService;
use Common\Service\Helper\GuidanceHelperService;
use Laminas\Form\Form;
use LmcRbacMvc\Service\AuthorizationService;

/**
* Application Type Of Licence Form
*
* @author Alex Peshkov <[email protected]>
*/
class ApplicationTypeOfLicence extends CommonLicenceTypeOfLicence
{
protected FormHelperService $formHelper;
protected AuthorizationService $authService;
protected Permission $permissionService;
protected GuidanceHelperService $guidanceHelper;
protected FormServiceManager $formServiceLocator;

public function __construct(
FormHelperService $formHelper,
AuthorizationService $authService,
Permission $permissionService,
GuidanceHelperService $guidanceHelper,
FormServiceManager $formServiceLocator
) {
$this->guidanceHelper = $guidanceHelper;
parent::__construct($formHelper, $authService, $formServiceLocator);
parent::__construct($formHelper, $permissionService, $formServiceLocator);
}
/**
* Alter form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace OlcsTest\FormService\Form\Lva\TypeOfLicence;

use Common\Rbac\Service\Permission;
use Common\Service\Helper\FormHelperService;
use Common\Service\Helper\GuidanceHelperService;
use Laminas\Form\ElementInterface;
Expand All @@ -10,13 +11,7 @@
use Olcs\FormService\Form\Lva\TypeOfLicence\ApplicationTypeOfLicence;
use Laminas\Form\Form;
use Common\FormService\FormServiceManager;
use LmcRbacMvc\Service\AuthorizationService;

/**
* Application Type of Licence Form Test
*
* @author Alex Peshkov <[email protected]>
*/
class ApplicationTypeOfLicenceTest extends MockeryTestCase
{
/**
Expand All @@ -27,17 +22,20 @@ class ApplicationTypeOfLicenceTest extends MockeryTestCase
protected $fh;

protected $fsm;
private $permission;

public function setUp(): void
{
$this->fh = m::mock(FormHelperService::class)->makePartial();
$this->guidanceHelper = m::mock(GuidanceHelperService::class);
$this->fsm = m::mock(FormServiceManager::class)->makePartial();
$this->sut = new ApplicationTypeOfLicence($this->fh, m::mock(AuthorizationService::class), $this->guidanceHelper, $this->fsm);
$this->permission = m::mock(Permission::class);
$this->sut = new ApplicationTypeOfLicence($this->fh, $this->permission, $this->guidanceHelper, $this->fsm);
}

public function testAlterForm()
public function testAlterForm(): void
{
$this->permission->expects('isInternalReadOnly')->withNoArgs()->andReturnFalse();

$mockForm = m::mock(Form::class)
->shouldReceive('get')
Expand Down
Loading