diff --git a/composer.lock b/composer.lock index 5a7a28529..fd1ad9f73 100644 --- a/composer.lock +++ b/composer.lock @@ -3982,16 +3982,16 @@ }, { "name": "olcs/olcs-common", - "version": "v6.2.0", + "version": "v6.2.2", "source": { "type": "git", "url": "https://github.com/dvsa/olcs-common.git", - "reference": "ae47a59eee2d4d6f4a26763a7285585d90df613f" + "reference": "fa9e8e8566f3e088d11f7c6eb9042578dd17c79d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dvsa/olcs-common/zipball/ae47a59eee2d4d6f4a26763a7285585d90df613f", - "reference": "ae47a59eee2d4d6f4a26763a7285585d90df613f", + "url": "https://api.github.com/repos/dvsa/olcs-common/zipball/fa9e8e8566f3e088d11f7c6eb9042578dd17c79d", + "reference": "fa9e8e8566f3e088d11f7c6eb9042578dd17c79d", "shasum": "" }, "require": { @@ -4049,9 +4049,9 @@ "notification-url": "https://packagist.org/downloads/", "description": "Common library for the OLCS Project", "support": { - "source": "https://github.com/dvsa/olcs-common/tree/v6.2.0" + "source": "https://github.com/dvsa/olcs-common/tree/v6.2.2" }, - "time": "2024-03-01T13:21:23+00:00" + "time": "2024-03-05T13:03:07+00:00" }, { "name": "olcs/olcs-logging", @@ -8024,5 +8024,5 @@ "platform-overrides": { "ext-redis": "4.3" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/module/Olcs/src/FormService/Form/Lva/AbstractLvaFormServiceFactory.php b/module/Olcs/src/FormService/Form/Lva/AbstractLvaFormServiceFactory.php index 4f6158ac4..dbf490903 100644 --- a/module/Olcs/src/FormService/Form/Lva/AbstractLvaFormServiceFactory.php +++ b/module/Olcs/src/FormService/Form/Lva/AbstractLvaFormServiceFactory.php @@ -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; @@ -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); diff --git a/module/Olcs/src/FormService/Form/Lva/TypeOfLicence/ApplicationTypeOfLicence.php b/module/Olcs/src/FormService/Form/Lva/TypeOfLicence/ApplicationTypeOfLicence.php index 94f8635ad..eb8cbfcab 100644 --- a/module/Olcs/src/FormService/Form/Lva/TypeOfLicence/ApplicationTypeOfLicence.php +++ b/module/Olcs/src/FormService/Form/Lva/TypeOfLicence/ApplicationTypeOfLicence.php @@ -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 - */ 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 diff --git a/test/Olcs/src/FormService/Form/Lva/TypeOfLicence/ApplicationTypeOfLicenceTest.php b/test/Olcs/src/FormService/Form/Lva/TypeOfLicence/ApplicationTypeOfLicenceTest.php index 7eec45081..dc96d7632 100644 --- a/test/Olcs/src/FormService/Form/Lva/TypeOfLicence/ApplicationTypeOfLicenceTest.php +++ b/test/Olcs/src/FormService/Form/Lva/TypeOfLicence/ApplicationTypeOfLicenceTest.php @@ -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; @@ -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 - */ class ApplicationTypeOfLicenceTest extends MockeryTestCase { /** @@ -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')