Skip to content

Commit

Permalink
phpcbf app/src/App/DataAccess
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbagg1 committed Nov 15, 2023
1 parent 1b99b87 commit 7b32ade
Show file tree
Hide file tree
Showing 32 changed files with 307 additions and 394 deletions.
7 changes: 2 additions & 5 deletions service-api/app/features/bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

declare(strict_types=1);

use Mezzio\Application;
use Mezzio\MiddlewareFactory;

/** @var \Mezzio\Application $app */
$app = $container->get(Application::class);
$factory = $container->get(MiddlewareFactory::class);
$app = $container->get(\Mezzio\Application::class);
$factory = $container->get(\Mezzio\MiddlewareFactory::class);

// Execute programmatic/declarative middleware pipeline and routing
// configuration statements
Expand Down
19 changes: 6 additions & 13 deletions service-api/app/features/bootstrap/config.pact.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@

declare(strict_types=1);

use App\DataAccess\ApiGateway\ActorCodes;
use BehatTest\DataAccess\ApiGateway\PactActorCodesFactory;
use App\DataAccess\ApiGateway\InstructionsAndPreferencesImages;
use BehatTest\DataAccess\ApiGateway\PactInstructionsAndPreferencesImagesFactory;
use App\DataAccess\ApiGateway\Lpas;
use BehatTest\DataAccess\ApiGateway\PactLpasFactory;

return [
'dependencies' => [
'factories' => [
ActorCodes::class
=> PactActorCodesFactory::class,
InstructionsAndPreferencesImages::class
=> PactInstructionsAndPreferencesImagesFactory::class,
Lpas::class
=> PactLpasFactory::class,
App\DataAccess\ApiGateway\ActorCodes::class
=> BehatTest\DataAccess\ApiGateway\PactActorCodesFactory::class,
App\DataAccess\ApiGateway\InstructionsAndPreferencesImages::class
=> BehatTest\DataAccess\ApiGateway\PactInstructionsAndPreferencesImagesFactory::class,
App\DataAccess\ApiGateway\Lpas::class
=> BehatTest\DataAccess\ApiGateway\PactLpasFactory::class,
],
],
];
61 changes: 33 additions & 28 deletions service-api/app/features/bootstrap/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,73 @@
declare(strict_types=1);

use Laminas\ConfigAggregator\ConfigAggregator;
use Http\Adapter\Guzzle6\Client;
use BehatTest\Http\Adapter\Guzzle6\TestClientFactory;
use Aws\Sdk;
use BehatTest\Common\Service\Aws\SdkFactory;
use App\Service\Log\RequestTracingLogProcessorFactory;

return [
'debug' => true,
'debug' => true,
ConfigAggregator::ENABLE_CACHE => false,
'dependencies' => [

'dependencies' => [
'factories' => [
Client::class => TestClientFactory::class,
Http\Adapter\Guzzle6\Client::class => BehatTest\Http\Adapter\Guzzle6\TestClientFactory::class,
GuzzleHttp\Client::class => BehatTest\GuzzleHttp\TestClientFactory::class,
Sdk::class => SdkFactory::class,

Aws\Sdk::class => BehatTest\Common\Service\Aws\SdkFactory::class,
],
],
'aws' => [
'region' => 'eu-west-1',
'version' => 'latest',

'aws' => [
'region' => 'eu-west-1',
'version' => 'latest',

'DynamoDb' => [
'endpoint' => 'https://dynamodb',
],
],
'monolog' => [
'handlers' => [

'monolog' => [
'handlers' => [
'default' => [ // default configuration in normal operation
'type' => 'test',
'type' => 'test',
'processors' => [
'psrLogProcessor',
'requestTracingProcessor',
],
],
],
'processors' => [
'psrLogProcessor' => [
'type' => 'psrLogMessage',
'psrLogProcessor' => [
'type' => 'psrLogMessage',
'options' => [], // No options
],
'requestTracingProcessor' => [
'type' => RequestTracingLogProcessorFactory::class,
'type' => \App\Service\Log\RequestTracingLogProcessorFactory::class,
'options' => [], // No options
],
],
],
'repositories' => [

'repositories' => [
'dynamodb' => [
'actor-codes-table' => 'actor-codes',
'actor-users-table' => 'actor-users',
'viewer-codes-table' => 'viewer-codes',
'actor-codes-table' => 'actor-codes',
'actor-users-table' => 'actor-users',
'viewer-codes-table' => 'viewer-codes',
'viewer-activity-table' => 'viewer-activity',
'user-lpa-actor-map' => 'user-actor-lpa-map',
'user-lpa-actor-map' => 'user-actor-lpa-map',
],
],
'sirius_api' => [

'sirius_api' => [
'endpoint' => 'http://api-gateway-pact-mock',
],
'codes_api' => [
'endpoint' => 'http://lpa-codes-pact-mock',

'codes_api' => [
'endpoint' => 'http://lpa-codes-pact-mock',
'static_auth_token' => getenv('LPA_CODES_STATIC_AUTH_TOKEN') ?: null,
],
'iap_images_api' => [

'iap_images_api' => [
'endpoint' => 'http://iap-images-mock',
],
'feature_flags' => [],

'feature_flags' => [],
];
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
new PhpFileProvider(realpath(__DIR__) . '/../../config/config.php'),

// Load development config if it exists
new PhpFileProvider(realpath(__DIR__) . '/config.php'),
new PhpFileProvider(realpath(__DIR__) . '/config.php')
]
);

Expand Down
4 changes: 4 additions & 0 deletions service-api/app/features/context/Acceptance/CommonContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
use PHPUnit\Framework\Assert;

/**
* Class CommonContext
*
* @package BehatTest\Context\UI
*
* @property $traceId The X-Amzn-Trace-Id that gets attached to incoming requests by the AWS LB
*/
class CommonContext implements Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function setFeatureFlag(BeforeScenarioScope $scope): void
throw new Exception('Feature flag values must be boolean');
}

$config = $this->base->container->get('config');
$config = $this->base->container->get('config');
$config['feature_flags'][$tagParts[1]] = $flagValue;
$this->base->container->set('config', $config);
$this->base->container->set(
Expand Down
8 changes: 4 additions & 4 deletions service-api/app/features/context/Acceptance/LpaContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function aRecordOfMyActivationKeyRequestIsSaved(): void
*/
public function aRecordOfMyActivationKeyRequestIsUpdated(): void
{
$dt = (new DateTime('now'))->add(new DateInterval('P1Y'));
$dt = (new DateTime('now'))->add(new \DateInterval('P1Y'));

$lastCommand = $this->awsFixtures->getLastCommand();
Assert::assertEquals($lastCommand->getName(), 'UpdateItem');
Expand Down Expand Up @@ -1842,7 +1842,7 @@ public function iRequestToViewAnLPAWhichStatusIs($status)

$response = $this->getResponseAsJson();

if ($status === 'Revoked') {
if ($status == 'Revoked') {
Assert::assertEmpty($response);
} else {
Assert::assertEquals($this->userLpaActorToken, $response['user-lpa-actor-token']);
Expand Down Expand Up @@ -2643,7 +2643,7 @@ public function aRepeatRequestForALetterContainingAOneTimeUseCodeIsMade(): void
'SiriusUid' => $this->lpaUid,
'ActorId' => $this->actorId,
'Added' => (new DateTime())->format('Y-m-d\TH:i:s.u\Z'),
'ActivateBy' => (new DateTime())->add(new DateInterval('P1Y'))->getTimestamp(),
'ActivateBy' => (new DateTime())->add(new \DateInterval('P1Y'))->getTimestamp(),
]
),
],
Expand All @@ -2662,7 +2662,7 @@ public function aRepeatRequestForALetterContainingAOneTimeUseCodeIsMade(): void
'SiriusUid' => $this->lpaUid,
'ActorId' => $this->actorId,
'Added' => (new DateTime())->format('Y-m-d\TH:i:s.u\Z'),
'ActivateBy' => (new DateTime())->add(new DateInterval('P1Y'))->getTimestamp(),
'ActivateBy' => (new DateTime())->add(new \DateInterval('P1Y'))->getTimestamp(),
]
),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public function gatherContexts(BeforeScenarioScope $scope): void
{
$environment = $scope->getEnvironment();

$this->base = $environment->getContext(BaseAcceptanceContext::class);
$this->ui = $this->base->ui; // MinkContext gathered in BaseUiContext
$this->base = $environment->getContext(BaseAcceptanceContext::class);
$this->ui = $this->base->ui; // MinkContext gathered in BaseUiContext
$this->apiFixtures = $this->base->apiFixtures;
$this->awsFixtures = $this->base->awsFixtures;
}
Expand Down
Loading

0 comments on commit 7b32ade

Please sign in to comment.