diff --git a/app/api/module/Api/data/nr/checkGoodReputeRequestTemplate.xml b/app/api/module/Api/data/nr/checkGoodReputeRequestTemplate.xml
new file mode 100644
index 0000000000..30811db825
--- /dev/null
+++ b/app/api/module/Api/data/nr/checkGoodReputeRequestTemplate.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/api/module/Api/data/nr/checkGoodReputeResponseTemplate.xml b/app/api/module/Api/data/nr/checkGoodReputeResponseTemplate.xml
new file mode 100644
index 0000000000..15e96bc6bd
--- /dev/null
+++ b/app/api/module/Api/data/nr/checkGoodReputeResponseTemplate.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/api/module/Api/src/Domain/QueryHandler/Nr/ReputeUrl.php b/app/api/module/Api/src/Domain/QueryHandler/Nr/ReputeUrl.php
index f27ed3c567..c5cbb674f1 100644
--- a/app/api/module/Api/src/Domain/QueryHandler/Nr/ReputeUrl.php
+++ b/app/api/module/Api/src/Domain/QueryHandler/Nr/ReputeUrl.php
@@ -37,9 +37,9 @@ public function handleQuery(QueryInterface $query)
/* @var $transportManager TransportManagerEntity */
$transportManager = $repo->fetchUsingId($query);
- if (!$transportManager->hasReputeCheckData()) {
+ //if (!$transportManager->hasReputeCheckData()) {
return ['reputeUrl' => null];
- }
+ //}
$person = $transportManager->getHomeCd()->getPerson();
diff --git a/app/api/module/Api/src/Entity/Tm/TransportManager.php b/app/api/module/Api/src/Entity/Tm/TransportManager.php
index 96df5c86be..15e4fbd09f 100644
--- a/app/api/module/Api/src/Entity/Tm/TransportManager.php
+++ b/app/api/module/Api/src/Entity/Tm/TransportManager.php
@@ -362,11 +362,9 @@ public function getMostRecentQualification()
}
/**
- * Returns whether the entity has all the necessary date for a repute check
- *
- * return bool
+ * Does the entity have all address data for a repute check
*/
- public function hasReputeCheckData()
+ public function hasReputeCheckAddress(): bool
{
// mandatory fields
$fields = [
@@ -384,14 +382,14 @@ public function hasReputeCheckData()
}
}
- //qualifications array collection
- if ($this->qualifications->isEmpty()) {
- return false;
- }
-
return true;
}
+ public function hasQualifications(): bool
+ {
+ return !$this->qualifications->isEmpty();
+ }
+
/**
* Return extra properties when serialzed
*
diff --git a/app/api/module/Api/src/Service/Nr/AbstractXmlRequest.php b/app/api/module/Api/src/Service/Nr/AbstractXmlRequest.php
new file mode 100644
index 0000000000..780977c4e8
--- /dev/null
+++ b/app/api/module/Api/src/Service/Nr/AbstractXmlRequest.php
@@ -0,0 +1,65 @@
+responseDateTime = $dateTime->format(\DateTime::ATOM);
+ $this->timeoutDateTime = $dateTime->add(new \DateInterval('PT10S'))->format(\DateTime::ATOM);
+ $this->technicalId = $this->generateGuid();
+ $this->authority = self::AUTHORITY_TC;
+ }
+
+ protected function getHeader(string $workflowId, string $memberStateCode): array
+ {
+ //if member state was GB, we need to make this UK
+ $filteredMemberStateCode = ($memberStateCode === 'GB' ? 'UK' : $memberStateCode);
+
+ return [
+ 'name' => 'Header',
+ 'attributes' => [
+ 'version' => $this->erruVersion,
+ 'technicalId' => $this->technicalId,
+ 'workflowId' => $workflowId,
+ 'sentAt' => $this->responseDateTime,
+ 'timeoutValue' => $this->timeoutDateTime,
+ 'from' => 'UK',
+ 'to' => $filteredMemberStateCode
+ ],
+ ];
+ }
+
+ protected function generateGuid(): string
+ {
+ // com_create_guid is unavailable on our environments
+ return sprintf(
+ '%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
+ mt_rand(0, 65535),
+ mt_rand(0, 65535),
+ mt_rand(0, 65535),
+ mt_rand(16384, 20479),
+ mt_rand(32768, 49151),
+ mt_rand(0, 65535),
+ mt_rand(0, 65535),
+ mt_rand(0, 65535)
+ );
+ }
+}
diff --git a/app/api/module/Api/src/Service/Nr/CheckGoodRepute.php b/app/api/module/Api/src/Service/Nr/CheckGoodRepute.php
new file mode 100644
index 0000000000..0cd13f99a7
--- /dev/null
+++ b/app/api/module/Api/src/Service/Nr/CheckGoodRepute.php
@@ -0,0 +1,64 @@
+hasReputeCheckAddress()) {
+ throw new ForbiddenException('No Tm address information available for repute check');
+ }
+
+ $xmlData = [
+ 'Header' => $this->getHeader($this->generateGuid(), 'ZZ'),
+ 'Body' => $this->getBody($transportManager)
+ ];
+
+ $this->xmlBuilder->setData($xmlData);
+ return $this->xmlBuilder->buildTemplate();
+ }
+
+ /**
+ * Fetches array of information for the xml body
+ */
+ private function getBody(TransportManager $transportManager): array
+ {
+ return [
+ 'name' => 'Body',
+ 'attributes' => [
+ 'businessCaseId' => $this->generateGuid(),
+ 'originatingAuthority' => $this->authority,
+ 'requestPurpose' => 'Other',
+ 'requestSource' => 'Other',
+ ],
+ 'nodes' => [
+ 0 => [
+ 'name' => 'SearchedTransportManager',
+ 'nodes' => [
+ 0 => [
+ 'name' => 'TransportUndertakingAddress',
+ 'attributes' => [
+ 'address' => 'address',
+ 'postcode' => 'postcode',
+ 'city' => 'city',
+ 'country' => 'UK',
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
+ }
+
+ private function getTransportManagerDetails(TransportManager $transportManager): array
+ {
+
+ }
+}
diff --git a/app/api/module/Api/src/Service/Nr/CheckGoodReputeFactory.php b/app/api/module/Api/src/Service/Nr/CheckGoodReputeFactory.php
new file mode 100644
index 0000000000..a153d697db
--- /dev/null
+++ b/app/api/module/Api/src/Service/Nr/CheckGoodReputeFactory.php
@@ -0,0 +1,32 @@
+get('config');
+ if (!isset($config['nr']['compliance_episode']['xmlNs'])) {
+ throw new \RuntimeException(self::XML_NS_MSG);
+ }
+
+ if (!isset($config['nr']['compliance_episode']['erruVersion'])) {
+ throw new \RuntimeException(self::XML_VERSION_MSG);
+ }
+
+ $ns = $config['nr']['compliance_episode']['xmlNs'];
+ $erruVersion = $config['nr']['compliance_episode']['erruVersion'];
+
+ $xmlBuilder = new XmlNodeBuilder(self::ROOT_ELEMENT, $ns . $erruVersion, []);
+ return new CheckGoodRepute($xmlBuilder, $erruVersion);
+ }
+}
diff --git a/app/api/module/Api/src/Service/Nr/MsiResponse.php b/app/api/module/Api/src/Service/Nr/MsiResponse.php
index f364d827e9..854b8e59ed 100644
--- a/app/api/module/Api/src/Service/Nr/MsiResponse.php
+++ b/app/api/module/Api/src/Service/Nr/MsiResponse.php
@@ -1,117 +1,19 @@
xmlBuilder;
- }
-
- public function getResponseDateTime(): string
- {
- return $this->responseDateTime;
- }
-
- public function setResponseDateTime(string $responseDateTime): void
- {
- $this->responseDateTime = $responseDateTime;
- }
-
- public function setTimeoutDateTime(string $timeoutDateTime): void
- {
- $this->timeoutDateTime = $timeoutDateTime;
- }
-
- public function getTimeoutDateTime(): string
- {
- return $this->timeoutDateTime;
- }
-
- /**
- * Gets the technical id
- *
- * @return String
- */
- public function getTechnicalId()
- {
- return $this->technicalId;
- }
-
- /**
- * Sets the technical id
- *
- * @param String $technicalId technical id
- *
- * @return void
- */
- public function setTechnicalId($technicalId)
- {
- $this->technicalId = $technicalId;
- }
-
- /**
- * Gets the originating authority
- *
- * @return String
- */
- public function getAuthority()
- {
- return $this->authority;
- }
-
- /**
- * Sets the originating authority
- *
- * @param String $authority originating authority
- *
- * @return void
- */
- public function setAuthority($authority)
- {
- $this->authority = $authority;
- }
/**
* Creates the Msi response, returns xml string
@@ -124,21 +26,14 @@ public function create(CasesEntity $case): string
throw new ForbiddenException('Unable to send Msi Response');
}
- $this->setTechnicalId($this->generateGuid());
- $dateTime = new DateTimeExtended();
- $this->setResponseDateTime($dateTime->format(\DateTime::ATOM));
- $this->setTimeoutDateTime($dateTime->add(new \DateInterval('PT10S'))->format(\DateTime::ATOM));
-
if ($case->getLicence() === null) {
- $this->setAuthority(self::AUTHORITY_TRU);
- } else {
- $this->setAuthority(self::AUTHORITY_TC);
+ $this->authority = self::AUTHORITY_TRU;
}
$erruRequest = $case->getErruRequest();
$xmlData = [
- 'Header' => $this->getHeader($erruRequest),
+ 'Header' => $this->getHeader($erruRequest->getWorkflowId(), $erruRequest->getMemberStateCode()->getId()),
'Body' => $this->getBody($case, $erruRequest)
];
@@ -146,29 +41,6 @@ public function create(CasesEntity $case): string
return $this->xmlBuilder->buildTemplate();
}
- /**
- * Fetches array of header information for the XML
- */
- private function getHeader(ErruRequestEntity $erruRequest): array
- {
- //if member state was GB, we need to make this UK
- $memberStateCode = $erruRequest->getMemberStateCode()->getId();
- $filteredMemberStateCode = ($memberStateCode === 'GB' ? 'UK' : $memberStateCode);
-
- return [
- 'name' => 'Header',
- 'attributes' => [
- 'version' => $this->erruVersion,
- 'technicalId' => $this->getTechnicalId(),
- 'workflowId' => $erruRequest->getWorkflowId(),
- 'sentAt' => $this->getResponseDateTime(),
- 'timeoutValue' => $this->timeoutDateTime,
- 'from' => 'UK',
- 'to' => $filteredMemberStateCode
- ],
- ];
- }
-
/**
* Fetches array of information for the xml body
*/
@@ -179,7 +51,7 @@ private function getBody(CasesEntity $cases, ErruRequestEntity $erruRequest): ar
'attributes' => [
'businessCaseId' => $erruRequest->getNotificationNumber(),
'originatingAuthority' => $erruRequest->getOriginatingAuthority(),
- 'respondingAuthority' => $this->getAuthority(),
+ 'respondingAuthority' => $this->authority,
'statusCode' => 'OK',
],
'nodes' => [
@@ -227,7 +99,7 @@ private function formatPenalties(CollectionInterface $seriousInfringements): arr
foreach ($penalties as $penalty) {
$newPenalty = [];
- $newPenalty['authorityImposingPenalty'] = $this->getAuthority();
+ $newPenalty['authorityImposingPenalty'] = $this->authority;
$newPenalty['penaltyTypeImposed'] = $penalty->getSiPenaltyType()->getId();
if ($penalty->getImposed() === 'N') {
@@ -257,20 +129,4 @@ private function formatPenalties(CollectionInterface $seriousInfringements): arr
return $formattedPenalties;
}
-
- private function generateGuid(): string
- {
- // com_create_guid is unavailable on our environments
- return sprintf(
- '%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
- mt_rand(0, 65535),
- mt_rand(0, 65535),
- mt_rand(0, 65535),
- mt_rand(16384, 20479),
- mt_rand(32768, 49151),
- mt_rand(0, 65535),
- mt_rand(0, 65535),
- mt_rand(0, 65535)
- );
- }
}
diff --git a/app/api/test/module/Api/src/Entity/Tm/TransportManagerEntityTest.php b/app/api/test/module/Api/src/Entity/Tm/TransportManagerEntityTest.php
index 6b5f7a1f7f..e7e1176007 100644
--- a/app/api/test/module/Api/src/Entity/Tm/TransportManagerEntityTest.php
+++ b/app/api/test/module/Api/src/Entity/Tm/TransportManagerEntityTest.php
@@ -1,5 +1,7 @@
setQualifications($qualifications);
-
$person = new Person();
$person->setForename($forename);
$person->setFamilyName($familyName);
@@ -656,34 +654,47 @@ public function testHasReputeCheckData($forename, $familyName, $birthDate, $birt
$entity->setHomeCd($contactDetails);
- $this->assertEquals($result, $entity->hasReputeCheckData());
+ $this->assertEquals($result, $entity->hasReputeCheckAddress());
+ }
+
+ public function testHasQualificationsTrue(): void
+ {
+ $entity = new Entity();
+
+ $qualification = m::mock(TmQualification::class);
+ $qualificationCollection = new ArrayCollection([$qualification]);
+
+ $entity->setQualifications($qualificationCollection);
+ $this->assertTrue($entity->hasQualifications());
+ }
+
+ public function testHasQualificationsFalse(): void
+ {
+ $entity = new Entity();
+ $entity->setQualifications(new ArrayCollection());
+ $this->assertFalse($entity->hasQualifications());
}
/**
- * Data provider for testHasReputeCheckData
- *
- * @return array
+ * Data provider for testHasReputeCheckAddress
*/
- public function dpHasReputeCheckDataProvider()
+ public function dpHasReputeCheckDataProvider(): array
{
$forename = 'forename';
$familyName = 'family name';
$birthDate = new \DateTime('2015-12-25');
$birthPlace = 'birth place';
- $qualification = m::mock(TmQualification::class);
- $qualifications = new ArrayCollection([$qualification]);
return [
- [null, $familyName, $birthDate, $birthPlace, $qualifications, false],
- [$forename, null, $birthDate, $birthPlace, $qualifications, false],
- [$forename, $familyName, null, $birthPlace, $qualifications, false],
- [$forename, $familyName, $birthDate, null, $qualifications, false],
- [$forename, $familyName, $birthDate, $birthPlace, new ArrayCollection(), false],
- [$forename, $familyName, $birthDate, $birthPlace, $qualifications, true]
+ [null, $familyName, $birthDate, $birthPlace, false],
+ [$forename, null, $birthDate, $birthPlace, false],
+ [$forename, $familyName, null, $birthPlace, false],
+ [$forename, $familyName, $birthDate, null, false],
+ [$forename, $familyName, $birthDate, $birthPlace, true]
];
}
- public function testGetMostRecentQualification()
+ public function testGetMostRecentQualification(): void
{
$qual1 = new TmQualification();
$qual1->setIssuedDate(new \DateTime('2015-12-25 00:00:00'));
diff --git a/app/internal/module/Olcs/config/navigation-right-sidebar.config.php b/app/internal/module/Olcs/config/navigation-right-sidebar.config.php
index c0df7f6c8c..13329f7331 100644
--- a/app/internal/module/Olcs/config/navigation-right-sidebar.config.php
+++ b/app/internal/module/Olcs/config/navigation-right-sidebar.config.php
@@ -522,8 +522,8 @@
[
'id' => 'transport-manager-quick-actions-check-repute',
'label' => 'Check repute',
- 'uri' => '/', //set by the listener on page load
- 'target' => '_blank',
+ 'route' => 'transport-manager/check-repute',
+ 'use_route_match' => true,
'visible' => false
],
[
diff --git a/app/internal/module/Olcs/src/Listener/RouteParam/TransportManager.php b/app/internal/module/Olcs/src/Listener/RouteParam/TransportManager.php
index a4ed50fa73..af4df32e92 100644
--- a/app/internal/module/Olcs/src/Listener/RouteParam/TransportManager.php
+++ b/app/internal/module/Olcs/src/Listener/RouteParam/TransportManager.php
@@ -137,13 +137,10 @@ public function onTransportManager(EventInterface $e)
->setVisible(true);
}
- $reputeUrl = $this->getReputeUrl($id);
-
- if ($reputeUrl !== null && $this->getAuthService()->isGranted(RefData::PERMISSION_INTERNAL_EDIT)) {
+ if ($this->getAuthService()->isGranted(RefData::PERMISSION_INTERNAL_EDIT)) {
$this->getSidebarNavigation()
->findById('transport-manager-quick-actions-check-repute')
- ->setVisible(true)
- ->setUri($reputeUrl);
+ ->setVisible(true);
}
if (!is_null($data['removedDate'])) {
@@ -204,29 +201,6 @@ private function getTransportManager($id)
return $response->getResult();
}
- /**
- * Get the TM repute url
- *
- * @param int $id Transport Manager ID
- *
- * @return array
- * @throws \RuntimeException
- */
- private function getReputeUrl($id)
- {
- $query = $this->getAnnotationBuilder()->createQuery(ReputeUrlQry::create(['id' => $id]));
-
- $response = $this->getQueryService()->send($query);
-
- //sometimes there will genuinely be no repute url,
- //in these cases $response->isOk() will still return true
- if (!$response->isOk()) {
- throw new \RuntimeException("Error cannot get repute url");
- }
-
- return $response->getResult()['reputeUrl'];
- }
-
/**
* @param ContainerInterface $container
* @param $requestedName
diff --git a/app/internal/test/Olcs/src/Listener/RouteParam/TransportManagerTest.php b/app/internal/test/Olcs/src/Listener/RouteParam/TransportManagerTest.php
index a2e6aad333..76fa45910c 100644
--- a/app/internal/test/Olcs/src/Listener/RouteParam/TransportManagerTest.php
+++ b/app/internal/test/Olcs/src/Listener/RouteParam/TransportManagerTest.php
@@ -1,7 +1,13 @@
attach($eventManager);
}
- /**
- * Tests onTransportManager
- * @dataProvider onTransportManagerProvider
- */
- public function testOnTransportManager($reputeUrl)
+ public function testOnTransportManager(): void
{
$tmId = 1;
@@ -75,7 +76,6 @@ public function testOnTransportManager($reputeUrl)
$mockCheckRepute = m::mock(PageUri::class);
$mockCheckRepute->shouldReceive('setVisible')->with(true)->andReturnSelf();
- $mockCheckRepute->shouldReceive('setUri')->with($reputeUrl);
$mockDetailsReview = m::mock(PageMvc::class);
$mockDetailsReview->shouldReceive('setVisible')->with(true);
@@ -120,20 +120,20 @@ public function testOnTransportManager($reputeUrl)
->getMock()
);
- $this->setupGetTransportManager($sut, $tm, $reputeUrl);
+ $this->setupGetTransportManager($sut, $tm);
- $mockContainer = m::mock(\Laminas\View\Helper\Placeholder\Container::class);
+ $mockContainer = m::mock(Container::class);
$mockContainer->shouldReceive('prepend')->with($pageTitle);
$mockContainer->shouldReceive('set')->with($tm);
- $mockPlaceholder = m::mock(\Laminas\View\Helper\Placeholder::class);
+ $mockPlaceholder = m::mock(Placeholder::class);
$mockPlaceholder->shouldReceive('getContainer')->with('pageTitle')->andReturn($mockContainer);
$mockPlaceholder->shouldReceive('getContainer')->with('transportManager')->andReturn($mockContainer);
$mockPlaceholder->shouldReceive('getContainer')->once()->with('note')->andReturn(
m::mock()->shouldReceive('set')->once()->with($tm['latestNote']['comment'])->getMock()
);
- $mockViewHelperManager = m::mock(\Laminas\View\HelperPluginManager::class);
+ $mockViewHelperManager = m::mock(HelperPluginManager::class);
$mockViewHelperManager->shouldReceive('get')->with('placeholder')->andReturn($mockPlaceholder);
$mockViewHelperManager->shouldReceive('get')->with('pageTitle')->andReturn($mockContainer);
$mockViewHelperManager->shouldReceive('get')->with('url')->andReturn($mockUrl);
@@ -143,7 +143,7 @@ public function testOnTransportManager($reputeUrl)
$sut->onTransportManager($event);
}
- public function testOnTransportManagerNotMerged()
+ public function testOnTransportManagerNotMerged(): void
{
$tmId = 1;
$context = [
@@ -184,18 +184,18 @@ public function testOnTransportManagerNotMerged()
$this->setupGetTransportManager($sut, $tm);
- $mockContainer = m::mock(\Laminas\View\Helper\Placeholder\Container::class);
+ $mockContainer = m::mock(Container::class);
$mockContainer->shouldReceive('prepend')->with($pageTitle);
$mockContainer->shouldReceive('set')->with($tm);
- $mockPlaceholder = m::mock(\Laminas\View\Helper\Placeholder::class);
+ $mockPlaceholder = m::mock(Placeholder::class);
$mockPlaceholder->shouldReceive('getContainer')->with('pageTitle')->andReturn($mockContainer);
$mockPlaceholder->shouldReceive('getContainer')->with('transportManager')->andReturn($mockContainer);
$mockPlaceholder->shouldReceive('getContainer')->once()->with('note')->andReturn(
m::mock()->shouldReceive('set')->once()->with($tm['latestNote']['comment'])->getMock()
);
- $mockViewHelperManager = m::mock(\Laminas\View\HelperPluginManager::class);
+ $mockViewHelperManager = m::mock(HelperPluginManager::class);
$mockViewHelperManager->shouldReceive('get')->with('placeholder')->andReturn($mockPlaceholder);
$mockViewHelperManager->shouldReceive('get')->with('pageTitle')->andReturn($mockContainer);
$mockViewHelperManager->shouldReceive('get')->with('url')->andReturn($mockUrl);
@@ -228,7 +228,7 @@ public function testOnTransportManagerNotMerged()
$sut->onTransportManager($event);
}
- public function testOnTransportManagerMerged()
+ public function testOnTransportManagerMerged(): void
{
$tmId = 1;
$context = [
@@ -269,18 +269,18 @@ public function testOnTransportManagerMerged()
$this->setupGetTransportManager($sut, $tm);
- $mockContainer = m::mock(\Laminas\View\Helper\Placeholder\Container::class);
+ $mockContainer = m::mock(Container::class);
$mockContainer->shouldReceive('prepend')->with($pageTitle);
$mockContainer->shouldReceive('set')->with($tm);
- $mockPlaceholder = m::mock(\Laminas\View\Helper\Placeholder::class);
+ $mockPlaceholder = m::mock(Placeholder::class);
$mockPlaceholder->shouldReceive('getContainer')->with('pageTitle')->andReturn($mockContainer);
$mockPlaceholder->shouldReceive('getContainer')->with('transportManager')->andReturn($mockContainer);
$mockPlaceholder->shouldReceive('getContainer')->once()->with('note')->andReturn(
m::mock()->shouldReceive('set')->once()->with($tm['latestNote']['comment'])->getMock()
);
- $mockViewHelperManager = m::mock(\Laminas\View\HelperPluginManager::class);
+ $mockViewHelperManager = m::mock(HelperPluginManager::class);
$mockViewHelperManager->shouldReceive('get')->with('placeholder')->andReturn($mockPlaceholder);
$mockViewHelperManager->shouldReceive('get')->with('pageTitle')->andReturn($mockContainer);
$mockViewHelperManager->shouldReceive('get')->with('url')->andReturn($mockUrl);
@@ -305,21 +305,18 @@ public function testOnTransportManagerMerged()
$sut->onTransportManager($event);
}
- private function setupGetTransportManager(TransportManager $sut, array $tmData = [], $reputeUrl = null)
+ private function setupGetTransportManager(TransportManager $sut, array $tmData = []): void
{
$mockAnnotationBuilder = m::mock();
$mockQueryService = m::mock();
$mockTmResponse = m::mock();
- $mockNrResponse = m::mock();
- $mockAuthService = m::mock();
- if ($reputeUrl) {
- $mockAuthService
- ->shouldReceive('isGranted')
- ->with(RefData::PERMISSION_INTERNAL_EDIT)
- ->andReturn(true)
- ->once()
- ->getMock();
- }
+ $mockAuthService = m::mock(AuthorizationService::class);
+
+ $mockAuthService
+ ->expects('isGranted')
+ ->with(RefData::PERMISSION_INTERNAL_EDIT)
+ ->andReturnTrue()
+ ->getMock();
$mockAnnotationBuilder->shouldReceive('createQuery')->with(m::type(TmQry::class))->once()->andReturnUsing(
function ($dto) {
@@ -329,56 +326,31 @@ function ($dto) {
}
);
- $mockAnnotationBuilder->shouldReceive('createQuery')->with(m::type(ReputeQry::class))->once()->andReturnUsing(
- function ($dto) {
- $this->assertInstanceOf(ReputeQry::class, $dto);
- $this->assertSame(1, $dto->getId());
- return 'NR QUERY';
- }
- );
-
$mockQueryService->shouldReceive('send')->with('TM QUERY')->once()->andReturn($mockTmResponse);
- $mockQueryService->shouldReceive('send')->with('NR QUERY')->once()->andReturn($mockNrResponse);
$mockTmResponse->shouldReceive('isOk')->with()->once()->andReturn(true);
$mockTmResponse->shouldReceive('getResult')->with()->once()->andReturn($tmData);
- $mockNrResponse->shouldReceive('isOk')->once()->andReturn(true);
- $mockNrResponse->shouldReceive('getResult')->once()->andReturn(['reputeUrl' => $reputeUrl]);
$sut->setAnnotationBuilder($mockAnnotationBuilder);
$sut->setQueryService($mockQueryService);
$sut->setAuthService($mockAuthService);
}
- /**
- * data provider for testOnTransportManager
- */
- public function onTransportManagerProvider()
- {
- return [
- ['http://www.example.com'],
- [null]
- ];
- }
-
- /**
- * Tests create service
- */
- public function testInvoke()
+ public function testInvoke(): void
{
$mockAnnotationBuilder = m::mock();
$mockQueryService = m::mock();
$mockAuthService = m::mock();
$sidebarNav = m::mock(Navigation::class);
- $mockViewHelperManager = m::mock(\Laminas\View\HelperPluginManager::class);
+ $mockViewHelperManager = m::mock(HelperPluginManager::class);
$mockSl = m::mock(ContainerInterface::class);
$mockSl->shouldReceive('get')->with('ViewHelperManager')->andReturn($mockViewHelperManager);
$mockSl->shouldReceive('get')->with('right-sidebar')->andReturn($sidebarNav);
$mockSl->shouldReceive('get')->with('TransferAnnotationBuilder')->andReturn($mockAnnotationBuilder);
$mockSl->shouldReceive('get')->with('QueryService')->andReturn($mockQueryService);
- $mockSl->shouldReceive('get')->with(\LmcRbacMvc\Service\AuthorizationService::class)->andReturn($mockAuthService);
+ $mockSl->shouldReceive('get')->with(AuthorizationService::class)->andReturn($mockAuthService);
$sut = new TransportManager();
$service = $sut->__invoke($mockSl, TransportManager::class);