From aeaa8603d5862ff657aab1e109dbb975e066b267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Ivan=C4=8Di=C4=87?= <marko.ivancic@srce.hr> Date: Mon, 8 May 2023 09:17:41 +0200 Subject: [PATCH] WIP --- config-templates/module_accounting.php | 21 +-- hooks/hook_cron.php | 2 +- .../VersionedDataProvider.php} | 10 +- ...taProvider.php => CurrentDataProvider.php} | 8 +- ...Provider.php => VersionedDataProvider.php} | 14 +- .../Versioned}/Store.php | 10 +- .../Version20220801000000CreateIdpTable.php | 4 +- ...ion20220801000100CreateIdpVersionTable.php | 4 +- .../Version20220801000200CreateSpTable.php | 4 +- ...sion20220801000300CreateSpVersionTable.php | 4 +- .../Version20220801000400CreateUserTable.php | 4 +- ...on20220801000500CreateUserVersionTable.php | 4 +- ...20801000600CreateIdpSpUserVersionTable.php | 4 +- ...01000700CreateAuthenticationEventTable.php | 4 +- .../Versioned}/Store/RawActivity.php | 2 +- .../Versioned}/Store/Repository.php | 10 +- .../Versioned}/Store/TableConstants.php | 6 +- .../Current}/Store.php | 134 +++--------------- .../Store/Migrations/CreateIdpTable.php | 4 +- .../Store/Migrations/CreateSpTable.php | 4 +- .../Store/Migrations/CreateUserTable.php | 4 +- .../Migrations/CreateUserVersionTable.php | 4 +- .../Current}/Store/Repository.php | 6 +- .../Current}/Store/TableConstants.php | 3 +- .../Versioned}/Store.php | 4 +- .../CreateIdpSpUserVersionTable.php | 2 +- .../Store/Migrations/CreateIdpTable.php | 4 +- .../Migrations/CreateIdpVersionTable.php | 4 +- .../Store/Migrations/CreateSpTable.php | 4 +- .../Store/Migrations/CreateSpVersionTable.php | 4 +- .../Store/Migrations/CreateUserTable.php | 4 +- .../Migrations/CreateUserVersionTable.php | 4 +- .../Versioned}/Store/Repository.php | 2 +- .../Versioned}/Store/TableConstants.php | 2 +- .../Accounting/Bases/TableConstants.php | 2 + .../DoctrineDbal/Current/Store.php | 4 +- .../Version20240505100CreateSpTable.php | 2 +- .../Version20240505200CreateUserTable.php | 2 +- ...rsion20240505300CreateUserVersionTable.php | 4 +- .../DoctrineDbal/Current/Store/Repository.php | 13 +- .../Current/Store/TableConstants.php | 3 +- .../DoctrineDbal/Versioned/Store.php | 5 +- .../Version20220801000000CreateIdpTable.php | 4 +- ...ion20220801000100CreateIdpVersionTable.php | 2 +- .../Version20220801000200CreateSpTable.php | 4 +- ...sion20220801000300CreateSpVersionTable.php | 2 +- .../Version20220801000400CreateUserTable.php | 4 +- ...on20220801000500CreateUserVersionTable.php | 2 +- ...20801000600CreateIdpSpUserVersionTable.php | 2 +- .../Versioned/Store/Repository.php | 5 +- .../Versioned/Store/TableConstants.php | 3 +- .../VersionedDataTracker.php} | 11 +- ...DataTracker.php => CurrentDataTracker.php} | 6 +- ...taTracker.php => VersionedDataTracker.php} | 6 +- .../Authentication/Event/State/Oidc.php | 4 +- src/Entities/ConnectedService.php | 2 +- src/Entities/Providers/Identity/Oidc.php | 2 +- src/Entities/Providers/Service/Oidc.php | 2 +- src/ModuleConfiguration.php | 4 +- src/Services/JobRunner.php | 2 +- tests/config-templates/config.php | 4 +- tests/config-templates/module_accounting.php | 8 +- tests/src/Auth/Process/AccountingTest.php | 8 +- tests/src/Constants/RawRowResult.php | 2 +- .../Builders/DataProviderBuilderTest.php | 16 +-- ...0700CreateAuthenticationEventTableTest.php | 6 +- .../Versioned}/Store/RawActivityTest.php | 13 +- .../Versioned}/Store/RepositoryTest.php | 50 +++---- .../Versioned}/StoreTest.php | 50 +++---- .../CreateIdpSpUserVersionTableTest.php | 6 +- .../Store/Migrations/CreateIdpTableTest.php | 6 +- .../Migrations/CreateIdpVersionTableTest.php | 6 +- .../Store/Migrations/CreateSpTableTest.php | 6 +- .../Migrations/CreateSpVersionTableTest.php | 6 +- .../Store/Migrations/CreateUserTableTest.php | 6 +- .../Migrations/CreateUserVersionTableTest.php | 6 +- .../Versioned}/Store/RepositoryTest.php | 26 ++-- .../Versioned}/StoreTest.php | 29 ++-- .../Store => }/HashDecoratedStateTest.php | 2 +- .../RawConnectedServiceTest.php | 52 +++---- .../Versioned}/Store/RepositoryTest.php | 47 +++--- .../Versioned}/StoreTest.php | 40 +++--- .../Stores/Builders/DataStoreBuilderTest.php | 12 +- .../Versioned}/DataTrackerTest.php | 40 +++--- .../Versioned}/DataTrackerTest.php | 37 ++--- tests/src/ModuleConfigurationTest.php | 9 +- tests/src/Services/JobRunnerTest.php | 2 +- 87 files changed, 407 insertions(+), 498 deletions(-) rename src/Data/Providers/Activity/{Versioned/DoctrineDbal/DataProvider.php => DoctrineDbal/VersionedDataProvider.php} (89%) rename src/Data/Providers/ConnectedServices/DoctrineDbal/{Current/DataProvider.php => CurrentDataProvider.php} (94%) rename src/Data/Providers/ConnectedServices/DoctrineDbal/{Versioned/DataProvider.php => VersionedDataProvider.php} (80%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store.php (93%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000000CreateIdpTable.php (50%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000100CreateIdpVersionTable.php (56%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000200CreateSpTable.php (50%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000300CreateSpVersionTable.php (55%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000400CreateUserTable.php (50%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000500CreateUserVersionTable.php (56%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php (57%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000700CreateAuthenticationEventTable.php (94%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/RawActivity.php (99%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Repository.php (97%) rename src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/TableConstants.php (89%) rename src/Data/Stores/Accounting/Bases/{Current/DoctrineDbal => DoctrineDbal/Current}/Store.php (65%) rename src/Data/Stores/Accounting/Bases/{Current/DoctrineDbal => DoctrineDbal/Current}/Store/Migrations/CreateIdpTable.php (94%) rename src/Data/Stores/Accounting/Bases/{Current/DoctrineDbal => DoctrineDbal/Current}/Store/Migrations/CreateSpTable.php (94%) rename src/Data/Stores/Accounting/Bases/{Current/DoctrineDbal => DoctrineDbal/Current}/Store/Migrations/CreateUserTable.php (93%) rename src/Data/Stores/Accounting/Bases/{Current/DoctrineDbal => DoctrineDbal/Current}/Store/Migrations/CreateUserVersionTable.php (63%) rename src/Data/Stores/Accounting/Bases/{Current/DoctrineDbal => DoctrineDbal/Current}/Store/Repository.php (99%) rename src/Data/Stores/Accounting/Bases/{Current/DoctrineDbal => DoctrineDbal/Current}/Store/TableConstants.php (98%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store.php (99%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateIdpSpUserVersionTable.php (98%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateIdpTable.php (93%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateIdpVersionTable.php (93%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateSpTable.php (93%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateSpVersionTable.php (93%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateUserTable.php (93%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateUserVersionTable.php (94%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Repository.php (99%) rename src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/TableConstants.php (99%) rename src/Data/Trackers/Activity/{Versioned/DoctrineDbal/DataTracker.php => DoctrineDbal/VersionedDataTracker.php} (63%) rename src/Data/Trackers/ConnectedServices/DoctrineDbal/{Versioned/DataTracker.php => CurrentDataTracker.php} (89%) rename src/Data/Trackers/ConnectedServices/DoctrineDbal/{Current/DataTracker.php => VersionedDataTracker.php} (88%) rename tests/src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/Version20220801000700CreateAuthenticationEventTableTest.php (96%) rename tests/src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/RawActivityTest.php (95%) rename tests/src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/RepositoryTest.php (91%) rename tests/src/Data/Stores/Accounting/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/StoreTest.php (92%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateIdpSpUserVersionTableTest.php (94%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateIdpTableTest.php (94%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateIdpVersionTableTest.php (94%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateSpTableTest.php (94%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateSpVersionTableTest.php (94%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateUserTableTest.php (94%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/Migrations/CreateUserVersionTableTest.php (94%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/RepositoryTest.php (94%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/StoreTest.php (95%) rename tests/src/Data/Stores/Accounting/Bases/{Versioned/DoctrineDbal/Store => }/HashDecoratedStateTest.php (98%) rename tests/src/Data/Stores/Accounting/ConnectedServices/{Versioned/DoctrineDbal/Store => DoctrineDbal}/RawConnectedServiceTest.php (51%) rename tests/src/Data/Stores/Accounting/ConnectedServices/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/Store/RepositoryTest.php (87%) rename tests/src/Data/Stores/Accounting/ConnectedServices/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/StoreTest.php (85%) rename tests/src/Data/Trackers/Activity/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/DataTrackerTest.php (84%) rename tests/src/Data/Trackers/ConnectedServices/{Versioned/DoctrineDbal => DoctrineDbal/Versioned}/DataTrackerTest.php (78%) diff --git a/config-templates/module_accounting.php b/config-templates/module_accounting.php index 7a78f1e..479c2f6 100644 --- a/config-templates/module_accounting.php +++ b/config-templates/module_accounting.php @@ -58,7 +58,7 @@ $config = [ /** * Providers * - * DataProvider classes are used to fetch data about users in order to show it in users profile page UI. + * VersionedDataProvider classes are used to fetch data about users in order to show it in users profile page UI. * Each provider can also include tracking capability, which will be triggered / used automatically. * * Connected services provider is a class which will be used to provide summary data about services that user @@ -73,8 +73,8 @@ $config = [ /** * Default connected services provider which expects Doctrine DBAL compatible connection to be set below. */ - //Providers\ConnectedServices\DoctrineDbal\Versioned\DataProvider::class, - Providers\ConnectedServices\DoctrineDbal\Current\DataProvider::class, + //Providers\ConnectedServices\DoctrineDbal\VersionedDataProvider\VersionedDataProvider::class, + Providers\ConnectedServices\DoctrineDbal\CurrentDataProvider::class, /** * Activity provider is a class which will be used to provide list of authentication events which includes info @@ -88,7 +88,7 @@ $config = [ /** * Default activity provider which expects Doctrine DBAL compatible connection to be set below. */ - Providers\Activity\Versioned\DoctrineDbal\DataProvider::class, + Providers\Activity\DoctrineDbal\VersionedDataProvider::class, /** * Trackers @@ -117,19 +117,19 @@ $config = [ /** * Data provider connection keys. */ - Providers\ConnectedServices\DoctrineDbal\Versioned\DataProvider::class => [ + Providers\ConnectedServices\DoctrineDbal\VersionedDataProvider::class => [ ModuleConfiguration\ConnectionType::MASTER => 'doctrine_dbal_pdo_mysql', ModuleConfiguration\ConnectionType::SLAVE => [ 'doctrine_dbal_pdo_mysql', ], ], - Providers\ConnectedServices\DoctrineDbal\Current\DataProvider::class => [ + Providers\ConnectedServices\DoctrineDbal\CurrentDataProvider::class => [ ModuleConfiguration\ConnectionType::MASTER => 'doctrine_dbal_pdo_mysql', ModuleConfiguration\ConnectionType::SLAVE => [ 'doctrine_dbal_pdo_mysql', ], ], - Providers\Activity\Versioned\DoctrineDbal\DataProvider::class => [ + Providers\Activity\DoctrineDbal\VersionedDataProvider::class => [ ModuleConfiguration\ConnectionType::MASTER => 'doctrine_dbal_pdo_mysql', ModuleConfiguration\ConnectionType::SLAVE => [ 'doctrine_dbal_pdo_mysql', @@ -209,7 +209,7 @@ $config = [ ModuleConfiguration::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED => 10, /** - * DataTracker data retention policy. + * VersionedDataTracker data retention policy. * * Determines how long the tracked data will be stored. If null, data will be stored indefinitely. Otherwise, it * can be set as a duration for DateInterval, examples being below. For this to work, a cron tag must also @@ -230,8 +230,9 @@ $config = [ ModuleConfiguration::OPTION_CRON_TAG_FOR_JOB_RUNNER => 'accounting_job_runner', /** - * DataTracker data retention policy tag designates the cron tag to use for enforcing data retention policy. - * Make sure to add this tag to the cron module configuration if data retention policy is different from null. + * VersionedDataTracker data retention policy tag designates the cron tag to use for enforcing data retention + * policy. Make sure to add this tag to the cron module configuration if data retention policy is different + * from null. */ ModuleConfiguration::OPTION_CRON_TAG_FOR_TRACKER_DATA_RETENTION_POLICY => 'accounting_tracker_data_retention_policy', diff --git a/hooks/hook_cron.php b/hooks/hook_cron.php index 1972fb0..d045e20 100644 --- a/hooks/hook_cron.php +++ b/hooks/hook_cron.php @@ -51,7 +51,7 @@ function accounting_hook_cron(array &$cronInfo): void } /** - * DataTracker data retention policy handling. + * VersionedDataTracker data retention policy handling. */ $cronTagForTrackerDataRetentionPolicy = $moduleConfiguration->getCronTagForTrackerDataRetentionPolicy(); try { diff --git a/src/Data/Providers/Activity/Versioned/DoctrineDbal/DataProvider.php b/src/Data/Providers/Activity/DoctrineDbal/VersionedDataProvider.php similarity index 89% rename from src/Data/Providers/Activity/Versioned/DoctrineDbal/DataProvider.php rename to src/Data/Providers/Activity/DoctrineDbal/VersionedDataProvider.php index 1dd8419..e0b6f63 100644 --- a/src/Data/Providers/Activity/Versioned/DoctrineDbal/DataProvider.php +++ b/src/Data/Providers/Activity/DoctrineDbal/VersionedDataProvider.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Providers\Activity\Versioned\DoctrineDbal; +namespace SimpleSAML\Module\accounting\Data\Providers\Activity\DoctrineDbal; use Psr\Log\LoggerInterface; use SimpleSAML\Module\accounting\Data\Providers\Interfaces\ActivityInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal\DataTracker; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Trackers\Activity\DoctrineDbal\VersionedDataTracker; use SimpleSAML\Module\accounting\Data\Trackers\Interfaces\DataTrackerInterface; use SimpleSAML\Module\accounting\Entities\Activity; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Module\accounting\ModuleConfiguration; -class DataProvider implements ActivityInterface +class VersionedDataProvider implements ActivityInterface { protected ModuleConfiguration $moduleConfiguration; protected LoggerInterface $logger; @@ -86,7 +86,7 @@ class DataProvider implements ActivityInterface */ public function getTracker(): ?DataTrackerInterface { - return new DataTracker( + return new VersionedDataTracker( $this->moduleConfiguration, $this->logger, ModuleConfiguration\ConnectionType::MASTER, diff --git a/src/Data/Providers/ConnectedServices/DoctrineDbal/Current/DataProvider.php b/src/Data/Providers/ConnectedServices/DoctrineDbal/CurrentDataProvider.php similarity index 94% rename from src/Data/Providers/ConnectedServices/DoctrineDbal/Current/DataProvider.php rename to src/Data/Providers/ConnectedServices/DoctrineDbal/CurrentDataProvider.php index d3e5a72..323c867 100644 --- a/src/Data/Providers/ConnectedServices/DoctrineDbal/Current/DataProvider.php +++ b/src/Data/Providers/ConnectedServices/DoctrineDbal/CurrentDataProvider.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal\Current; +namespace SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal; use Psr\Log\LoggerInterface; use SimpleSAML\Module\accounting\Data\Providers\Interfaces\ConnectedServicesInterface; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Current\Store; -use SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Current\DataTracker; +use SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\CurrentDataTracker; use SimpleSAML\Module\accounting\Data\Trackers\Interfaces\DataTrackerInterface; use SimpleSAML\Module\accounting\Entities\ConnectedService; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Module\accounting\ModuleConfiguration; -class DataProvider implements ConnectedServicesInterface +class CurrentDataProvider implements ConnectedServicesInterface { protected ModuleConfiguration $moduleConfiguration; protected LoggerInterface $logger; @@ -86,7 +86,7 @@ class DataProvider implements ConnectedServicesInterface */ public function getTracker(): ?DataTrackerInterface { - return new DataTracker( + return new CurrentDataTracker( $this->moduleConfiguration, $this->logger, ModuleConfiguration\ConnectionType::MASTER, diff --git a/src/Data/Providers/ConnectedServices/DoctrineDbal/Versioned/DataProvider.php b/src/Data/Providers/ConnectedServices/DoctrineDbal/VersionedDataProvider.php similarity index 80% rename from src/Data/Providers/ConnectedServices/DoctrineDbal/Versioned/DataProvider.php rename to src/Data/Providers/ConnectedServices/DoctrineDbal/VersionedDataProvider.php index 08e0247..788da27 100644 --- a/src/Data/Providers/ConnectedServices/DoctrineDbal/Versioned/DataProvider.php +++ b/src/Data/Providers/ConnectedServices/DoctrineDbal/VersionedDataProvider.php @@ -2,21 +2,23 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal\Versioned; +namespace SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal; use Psr\Log\LoggerInterface; use SimpleSAML\Module\accounting\Data\Providers\Interfaces\ConnectedServicesInterface; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\VersionedDataTracker; use SimpleSAML\Module\accounting\Data\Trackers\Interfaces\DataTrackerInterface; use SimpleSAML\Module\accounting\Entities\ConnectedService; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Module\accounting\ModuleConfiguration; -class DataProvider implements ConnectedServicesInterface +class VersionedDataProvider implements ConnectedServicesInterface { protected ModuleConfiguration $moduleConfiguration; protected LoggerInterface $logger; - protected \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store $store; + protected Store $store; /** * @throws StoreException @@ -25,12 +27,12 @@ class DataProvider implements ConnectedServicesInterface ModuleConfiguration $moduleConfiguration, LoggerInterface $logger, string $connectionType = ModuleConfiguration\ConnectionType::SLAVE, - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store $store = null + Store $store = null ) { $this->moduleConfiguration = $moduleConfiguration; $this->logger = $logger; - $this->store = $store ?? new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store( + $this->store = $store ?? new Store( $this->moduleConfiguration, $this->logger, $this->moduleConfiguration->getClassConnectionKey(self::class), @@ -84,7 +86,7 @@ class DataProvider implements ConnectedServicesInterface */ public function getTracker(): ?DataTrackerInterface { - return new \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker( + return new VersionedDataTracker( $this->moduleConfiguration, $this->logger, ModuleConfiguration\ConnectionType::MASTER, diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store.php similarity index 93% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store.php index 7b4e290..149b8bc 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned; use DateTimeImmutable; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\RawActivity; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Repository; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\RawActivity; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Repository; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store as BaseStore; use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store as BaseStore; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory; use SimpleSAML\Module\accounting\Data\Stores\Interfaces\ActivityInterface; use SimpleSAML\Module\accounting\Entities\Activity; @@ -140,7 +140,7 @@ class Store extends BaseStore implements ActivityInterface */ public function deleteDataOlderThan(DateTimeImmutable $dateTime): void { - // Only delete authentication events. Versioned data (IdP / SP metadata, user attributes) remain. + // Only delete authentication events. VersionedDataProvider data (IdP / SP metadata, user attributes) remain. $this->repository->deleteAuthenticationEventsOlderThan($dateTime); } } diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000000CreateIdpTable.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000000CreateIdpTable.php similarity index 50% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000000CreateIdpTable.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000000CreateIdpTable.php index bc43464..ad3f84c 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000000CreateIdpTable.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000000CreateIdpTable.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable; class Version20220801000000CreateIdpTable extends CreateIdpTable { diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000100CreateIdpVersionTable.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000100CreateIdpVersionTable.php similarity index 56% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000100CreateIdpVersionTable.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000100CreateIdpVersionTable.php index 2f867a4..31bb2d4 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000100CreateIdpVersionTable.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000100CreateIdpVersionTable.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; class Version20220801000100CreateIdpVersionTable extends Migrations\CreateIdpVersionTable { diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000200CreateSpTable.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000200CreateSpTable.php similarity index 50% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000200CreateSpTable.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000200CreateSpTable.php index fec8fd4..a340560 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000200CreateSpTable.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000200CreateSpTable.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable; class Version20220801000200CreateSpTable extends CreateSpTable { diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000300CreateSpVersionTable.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000300CreateSpVersionTable.php similarity index 55% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000300CreateSpVersionTable.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000300CreateSpVersionTable.php index acaa365..846629b 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000300CreateSpVersionTable.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000300CreateSpVersionTable.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; class Version20220801000300CreateSpVersionTable extends Migrations\CreateSpVersionTable { diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000400CreateUserTable.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000400CreateUserTable.php similarity index 50% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000400CreateUserTable.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000400CreateUserTable.php index fef4576..de24d65 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000400CreateUserTable.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000400CreateUserTable.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable; class Version20220801000400CreateUserTable extends CreateUserTable { diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000500CreateUserVersionTable.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000500CreateUserVersionTable.php similarity index 56% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000500CreateUserVersionTable.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000500CreateUserVersionTable.php index 9e2bee6..bd429ee 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000500CreateUserVersionTable.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000500CreateUserVersionTable.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; class Version20220801000500CreateUserVersionTable extends Migrations\CreateUserVersionTable { diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php similarity index 57% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php index c372d5b..4ac4a69 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; class Version20220801000600CreateIdpSpUserVersionTable extends Migrations\CreateIdpSpUserVersionTable { diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000700CreateAuthenticationEventTable.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000700CreateAuthenticationEventTable.php similarity index 94% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000700CreateAuthenticationEventTable.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000700CreateAuthenticationEventTable.php index b838ec6..d477b56 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000700CreateAuthenticationEventTable.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000700CreateAuthenticationEventTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RawActivity.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RawActivity.php similarity index 99% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RawActivity.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RawActivity.php index 3498626..ed7b42c 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RawActivity.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RawActivity.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; use DateTimeImmutable; use Doctrine\DBAL\Platforms\AbstractPlatform; diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Repository.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Repository.php similarity index 97% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Repository.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Repository.php index 7a52396..7071f00 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Repository.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Repository.php @@ -2,17 +2,15 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; use DateTimeImmutable; -use Doctrine\DBAL\ParameterType; -use Doctrine\DBAL\Result; use Doctrine\DBAL\Types\Types; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository as BaseRepository; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository as BaseRepository; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants as BaseTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use Throwable; diff --git a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/TableConstants.php b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/TableConstants.php similarity index 89% rename from src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/TableConstants.php rename to src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/TableConstants.php index 91b778d..df5b36c 100644 --- a/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/TableConstants.php +++ b/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/TableConstants.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants as - BaseTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants + as BaseTableConstants; class TableConstants { diff --git a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store.php similarity index 65% rename from src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store.php index 50b1593..0090783 100644 --- a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store.php @@ -2,11 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current; use Psr\Log\LoggerInterface; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Repository; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Repository; use SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractStore; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory; use SimpleSAML\Module\accounting\Data\Stores\Interfaces\StoreInterface; @@ -57,62 +58,6 @@ class Store extends AbstractStore implements StoreInterface ); } - /** - * @throws StoreException - */ - public function resolveIdpId(HashDecoratedState $hashDecoratedState): int - { - $idpEntityIdHashSha256 = $hashDecoratedState->getIdentityProviderEntityIdHashSha256(); - - // Check if it already exists. - try { - $result = $this->repository->getIdp($idpEntityIdHashSha256); - $idpId = $result->fetchOne(); - - if ($idpId !== false) { - return (int)$idpId; - } - } catch (Throwable $exception) { - $message = sprintf('Error resolving Idp ID. Error was: %s.', $exception->getMessage()); - throw new StoreException($message, (int)$exception->getCode(), $exception); - } - - // Create new - try { - $this->repository->insertIdp( - $hashDecoratedState->getState()->getIdentityProviderEntityId(), - $idpEntityIdHashSha256, - serialize($hashDecoratedState->getState()->getIdentityProviderMetadata()), - $hashDecoratedState->getIdentityProviderMetadataArrayHashSha256(), - ); - } catch (Throwable $exception) { - $message = sprintf( - 'Error inserting new IdP, however, continuing in case of race condition. Error was: %s.', - $exception->getMessage() - ); - $this->logger->warning($message); - } - - // Try again, this time it should exist... - try { - $result = $this->repository->getIdp($idpEntityIdHashSha256); - $idpIdNew = $result->fetchOne(); - - if ($idpIdNew !== false) { - return (int)$idpIdNew; - } - - $message = sprintf( - 'Error fetching IdP ID even after insertion for entity ID hash SHA256 %s.', - $idpEntityIdHashSha256 - ); - throw new StoreException($message); - } catch (Throwable $exception) { - $message = sprintf('Error resolving Idp ID. Error was: %s.', $exception->getMessage()); - throw new StoreException($message, (int)$exception->getCode(), $exception); - } - } - /** * @throws StoreException */ @@ -123,10 +68,22 @@ class Store extends AbstractStore implements StoreInterface // Check if it already exists. try { $result = $this->repository->getSp($spEntityIdHashSha256); - $spId = $result->fetchOne(); - - if ($spId !== false) { - return (int)$spId; + $sp = $result->fetchAssociative(); + + if ($sp !== false) { + $spId = (int)$sp[TableConstants::TABLE_SP_COLUMN_NAME_ID]; + // If metadata hash is different, update metadata. + if ( + $sp[TableConstants::TABLE_SP_COLUMN_NAME_METADATA_HASH_SHA256] !== + $hashDecoratedState->getServiceProviderMetadataArrayHashSha256() + ) { + $this->repository->updateSp( + $spId, + serialize($hashDecoratedState->getState()->getServiceProviderMetadata()), + $hashDecoratedState->getServiceProviderMetadataArrayHashSha256() + ); + } + return $spId; } } catch (Throwable $exception) { $message = sprintf('Error resolving SP ID. Error was: %s.', $exception->getMessage()); @@ -282,57 +239,4 @@ class Store extends AbstractStore implements StoreInterface throw new StoreException($message, (int)$exception->getCode(), $exception); } } - - /** - * @throws StoreException - */ - public function resolveIdpSpUserVersionId(int $idpVersionId, int $spVersionId, int $userVersionId): int - { - // Check if it already exists. - try { - $result = $this->repository->getIdpSpUserVersion($idpVersionId, $spVersionId, $userVersionId); - $IdpSpUserVersionId = $result->fetchOne(); - - if ($IdpSpUserVersionId !== false) { - return (int)$IdpSpUserVersionId; - } - } catch (Throwable $exception) { - $message = sprintf('Error resolving IdpSpUserVersion ID. Error was: %s.', $exception->getMessage()); - throw new StoreException($message, (int)$exception->getCode(), $exception); - } - - // Create new - try { - $this->repository->insertIdpSpUserVersion($idpVersionId, $spVersionId, $userVersionId); - } catch (Throwable $exception) { - $message = sprintf( - 'Error inserting new IdpSpUserVersion, however, continuing in case of race condition. ' . - 'Error was: %s.', - $exception->getMessage() - ); - $this->logger->warning($message); - } - - // Try again, this time it should exist... - try { - $result = $this->repository->getIdpSpUserVersion($idpVersionId, $spVersionId, $userVersionId); - $IdpSpUserVersionIdNew = $result->fetchOne(); - - if ($IdpSpUserVersionIdNew !== false) { - return (int)$IdpSpUserVersionIdNew; - } - - $message = sprintf( - 'Error fetching IdpSpUserVersion ID even after insertion for IdpVersion %s, SpVersion ID %s and ' . - 'UserVersion ID %s.', - $idpVersionId, - $spVersionId, - $userVersionId - ); - throw new StoreException($message); - } catch (Throwable $exception) { - $message = sprintf('Error resolving IdpSpUserVersion ID. Error was: %s.', $exception->getMessage()); - throw new StoreException($message, (int)$exception->getCode(), $exception); - } - } } diff --git a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateIdpTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateIdpTable.php similarity index 94% rename from src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateIdpTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateIdpTable.php index e9e37dd..840cd8f 100644 --- a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateIdpTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateIdpTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateSpTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateSpTable.php similarity index 94% rename from src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateSpTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateSpTable.php index 1fbdb92..5551faf 100644 --- a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateSpTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateSpTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateUserTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateUserTable.php similarity index 93% rename from src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateUserTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateUserTable.php index 538fa91..090357d 100644 --- a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateUserTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateUserTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateUserVersionTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateUserVersionTable.php similarity index 63% rename from src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateUserVersionTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateUserVersionTable.php index 94bffff..4bfee43 100644 --- a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Migrations/CreateUserVersionTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Migrations/CreateUserVersionTable.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable as VersionedCreateUserTable; class CreateUserVersionTable extends VersionedCreateUserTable diff --git a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Repository.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Repository.php similarity index 99% rename from src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Repository.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Repository.php index 20eb0a5..7ec179c 100644 --- a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/Repository.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/Repository.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store; use DateTimeImmutable; use Doctrine\DBAL\ParameterType; @@ -291,7 +291,7 @@ class Repository * @throws StoreException */ public function updateSp( - string $spId, + int $spId, string $metadata, string $metadataHashSha256, DateTimeImmutable $updatedAt = null @@ -341,7 +341,7 @@ class Repository $queryBuilder->executeStatement(); } catch (Throwable $exception) { $message = sprintf('Error executing query to update SP. Error was: %s.', $exception->getMessage()); - $this->logger->error($message, compact('spId','metadata', 'metadataHashSha256')); + $this->logger->error($message, compact('spId', 'metadata', 'metadataHashSha256')); throw new StoreException($message, (int)$exception->getCode(), $exception); } } diff --git a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/TableConstants.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/TableConstants.php similarity index 98% rename from src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/TableConstants.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/TableConstants.php index 1b71f80..40b45a0 100644 --- a/src/Data/Stores/Accounting/Bases/Current/DoctrineDbal/Store/TableConstants.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Current/Store/TableConstants.php @@ -2,7 +2,8 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store; + use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\TableConstants as BaseTableConstants; class TableConstants extends BaseTableConstants diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store.php similarity index 99% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store.php index cc6a9ac..6c3214b 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned; use Psr\Log\LoggerInterface; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository; use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository; use SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractStore; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory; use SimpleSAML\Module\accounting\Data\Stores\Interfaces\StoreInterface; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpSpUserVersionTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpSpUserVersionTable.php similarity index 98% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpSpUserVersionTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpSpUserVersionTable.php index 7037e25..dd05d1d 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpSpUserVersionTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpSpUserVersionTable.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpTable.php similarity index 93% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpTable.php index 917f957..7a37729 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpVersionTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpVersionTable.php similarity index 93% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpVersionTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpVersionTable.php index ae72dc4..fdbd7c5 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpVersionTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpVersionTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpTable.php similarity index 93% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpTable.php index ab72211..a168bdf 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpVersionTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpVersionTable.php similarity index 93% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpVersionTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpVersionTable.php index 9eb05f5..6f7a4c0 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpVersionTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpVersionTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserTable.php similarity index 93% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserTable.php index 410af13..511bf5b 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserVersionTable.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserVersionTable.php similarity index 94% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserVersionTable.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserVersionTable.php index 8781957..54b2693 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserVersionTable.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserVersionTable.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use Throwable; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Repository.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Repository.php similarity index 99% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Repository.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Repository.php index 7b70cb9..0284c4e 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Repository.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Repository.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store; use DateTimeImmutable; use Doctrine\DBAL\ParameterType; diff --git a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/TableConstants.php b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/TableConstants.php similarity index 99% rename from src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/TableConstants.php rename to src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/TableConstants.php index 178ce1c..72da460 100644 --- a/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/TableConstants.php +++ b/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/TableConstants.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store; use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\TableConstants as BaseTableConstants; diff --git a/src/Data/Stores/Accounting/Bases/TableConstants.php b/src/Data/Stores/Accounting/Bases/TableConstants.php index a21e461..5f5d656 100644 --- a/src/Data/Stores/Accounting/Bases/TableConstants.php +++ b/src/Data/Stores/Accounting/Bases/TableConstants.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases; class TableConstants diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store.php index 4f8427f..8e84d9c 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store.php @@ -6,7 +6,7 @@ namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\ use DateTimeImmutable; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store as BaseStore; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store as BaseStore; use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Current\Store\Repository; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService; @@ -80,7 +80,7 @@ class Store extends BaseStore implements ConnectedServicesInterface /** @psalm-suppress MixedAssignment */ $connectedServiceId = $this->repository->getConnectedService($spId, $userId)->fetchOne(); - if ($connectedServiceId!== false) { + if ($connectedServiceId !== false) { $this->repository->updateConnectedServiceVersionCount( (int)$connectedServiceId, $userVersionId, diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505100CreateSpTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505100CreateSpTable.php index 1362d3e..8f5d2ee 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505100CreateSpTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505100CreateSpTable.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Current\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Migrations\CreateSpTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Migrations\CreateSpTable; class Version20240505100CreateSpTable extends CreateSpTable { diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505200CreateUserTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505200CreateUserTable.php index 0e0772e..2120b20 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505200CreateUserTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505200CreateUserTable.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Current\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Migrations\CreateUserTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Migrations\CreateUserTable; class Version20240505200CreateUserTable extends CreateUserTable { diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505300CreateUserVersionTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505300CreateUserVersionTable.php index 510edc4..f3a60f2 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505300CreateUserVersionTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Migrations/Version20240505300CreateUserVersionTable.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Current\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Migrations\CreateUserVersionTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Migrations; -class Version20240505300CreateUserVersionTable extends CreateUserVersionTable +class Version20240505300CreateUserVersionTable extends Migrations\CreateUserVersionTable { } diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Repository.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Repository.php index f36c77d..74a8e62 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Repository.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/Repository.php @@ -9,8 +9,9 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Result; use Doctrine\DBAL\Types\Types; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\Repository as BaseRepository; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\TableConstants as BaseTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\Repository as BaseRepository; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\TableConstants + as BaseTableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use Throwable; @@ -68,7 +69,7 @@ class Repository extends BaseRepository 'Error executing query to get connected service. Error was: %s.', $exception->getMessage() ); - $this->logger->error($message, compact( 'spId', 'userId')); + $this->logger->error($message, compact('spId', 'userId')); throw new StoreException($message, (int)$exception->getCode(), $exception); } } @@ -237,27 +238,21 @@ class Repository extends BaseRepository BaseTableConstants::TABLE_ALIAS_SP . '.' . BaseTableConstants::TABLE_SP_COLUMN_NAME_ENTITY_ID . ' AS ' . TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_ENTITY_ID, - TableConstants::TABLE_ALIAS_CONNECTED_SERVICE . '.' . TableConstants::TABLE_CONNECTED_SERVICE_COLUMN_NAME_COUNT . ' AS ' . TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS, - TableConstants::TABLE_ALIAS_CONNECTED_SERVICE . '.' . TableConstants::TABLE_CONNECTED_SERVICE_COLUMN_NAME_LAST_AUTHENTICATION_AT . ' AS ' . TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_LAST_AUTHENTICATION_AT, - TableConstants::TABLE_ALIAS_CONNECTED_SERVICE . '.' . TableConstants::TABLE_CONNECTED_SERVICE_COLUMN_NAME_FIRST_AUTHENTICATION_AT . ' AS ' . TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_FIRST_AUTHENTICATION_AT, - BaseTableConstants::TABLE_ALIAS_SP . '.' . BaseTableConstants::TABLE_SP_COLUMN_NAME_METADATA . ' AS ' . TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA, - BaseTableConstants::TABLE_ALIAS_USER_VERSION . '.' . BaseTableConstants::TABLE_USER_VERSION_COLUMN_NAME_ATTRIBUTES . ' AS ' . TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES, - )->from($this->tableNameConnectedService, TableConstants::TABLE_ALIAS_CONNECTED_SERVICE) ->innerJoin( //'ccs', diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/TableConstants.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/TableConstants.php index 3e22110..d0331be 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/TableConstants.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Current/Store/TableConstants.php @@ -4,7 +4,8 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Current\Store; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Current\DoctrineDbal\Store\TableConstants as BaseTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Current\Store\TableConstants + as BaseTableConstants; class TableConstants { diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store.php index 2038d7b..6887a5b 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store.php @@ -6,8 +6,9 @@ namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\ use DateTimeImmutable; use Psr\Log\LoggerInterface; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store as BaseStore; use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store as BaseStore; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Repository; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory; use SimpleSAML\Module\accounting\Data\Stores\Interfaces\ConnectedServicesInterface; @@ -115,7 +116,7 @@ class Store extends BaseStore implements ConnectedServicesInterface /** @var array $result */ foreach ($results as $result) { - $rawConnectedServiceProvider = new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($result, $databasePlatform); + $rawConnectedServiceProvider = new RawConnectedService($result, $databasePlatform); $serviceProvider = $this->helpersManager ->getProviderResolver() diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000000CreateIdpTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000000CreateIdpTable.php index 3f33791..69e5d76 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000000CreateIdpTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000000CreateIdpTable.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; -class Version20220801000000CreateIdpTable extends CreateIdpTable +class Version20220801000000CreateIdpTable extends Migrations\CreateIdpTable { } diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000100CreateIdpVersionTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000100CreateIdpVersionTable.php index 4bc4702..70d4af5 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000100CreateIdpVersionTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000100CreateIdpVersionTable.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; class Version20220801000100CreateIdpVersionTable extends Migrations\CreateIdpVersionTable { diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000200CreateSpTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000200CreateSpTable.php index c1c207d..7a23c8e 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000200CreateSpTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000200CreateSpTable.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; -class Version20220801000200CreateSpTable extends CreateSpTable +class Version20220801000200CreateSpTable extends Migrations\CreateSpTable { } diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000300CreateSpVersionTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000300CreateSpVersionTable.php index e49f8a8..4a30007 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000300CreateSpVersionTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000300CreateSpVersionTable.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; class Version20220801000300CreateSpVersionTable extends Migrations\CreateSpVersionTable { diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000400CreateUserTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000400CreateUserTable.php index 4ebc647..30b6b9d 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000400CreateUserTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000400CreateUserTable.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; -class Version20220801000400CreateUserTable extends CreateUserTable +class Version20220801000400CreateUserTable extends Migrations\CreateUserTable { } diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000500CreateUserVersionTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000500CreateUserVersionTable.php index 93fb271..71c0190 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000500CreateUserVersionTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000500CreateUserVersionTable.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; class Version20220801000500CreateUserVersionTable extends Migrations\CreateUserVersionTable { diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php index 69fa2d3..6d4427b 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Migrations/Version20220801000600CreateIdpSpUserVersionTable.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; class Version20220801000600CreateIdpSpUserVersionTable extends Migrations\CreateIdpSpUserVersionTable { diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Repository.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Repository.php index 38d99c2..51f2f5a 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Repository.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/Repository.php @@ -9,8 +9,9 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Result; use Doctrine\DBAL\Types\Types; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository as BaseRepository; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants as BaseTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository as BaseRepository; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants + as BaseTableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use Throwable; diff --git a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/TableConstants.php b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/TableConstants.php index 350428f..028c4d5 100644 --- a/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/TableConstants.php +++ b/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/TableConstants.php @@ -4,7 +4,8 @@ declare(strict_types=1); namespace SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants as BaseTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants + as BaseTableConstants; class TableConstants { diff --git a/src/Data/Trackers/Activity/Versioned/DoctrineDbal/DataTracker.php b/src/Data/Trackers/Activity/DoctrineDbal/VersionedDataTracker.php similarity index 63% rename from src/Data/Trackers/Activity/Versioned/DoctrineDbal/DataTracker.php rename to src/Data/Trackers/Activity/DoctrineDbal/VersionedDataTracker.php index 5d1c786..8f30682 100644 --- a/src/Data/Trackers/Activity/Versioned/DoctrineDbal/DataTracker.php +++ b/src/Data/Trackers/Activity/DoctrineDbal/VersionedDataTracker.php @@ -2,23 +2,18 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal; +namespace SimpleSAML\Module\accounting\Data\Trackers\Activity\DoctrineDbal; use DateInterval; use DateTimeImmutable; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Providers\Activity\Versioned\DoctrineDbal\DataProvider; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Stores\Interfaces\DataStoreInterface; +use SimpleSAML\Module\accounting\Data\Providers\Activity\DoctrineDbal\VersionedDataProvider; use SimpleSAML\Module\accounting\Data\Trackers\Interfaces\DataTrackerInterface; -use SimpleSAML\Module\accounting\Entities\Activity; use SimpleSAML\Module\accounting\Entities\Authentication\Event; -use SimpleSAML\Module\accounting\Entities\ConnectedService; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\ModuleConfiguration; -use SimpleSAML\Module\accounting\Services\HelpersManager; -class DataTracker extends DataProvider implements DataTrackerInterface +class VersionedDataTracker extends VersionedDataProvider implements DataTrackerInterface { /** * @throws StoreException diff --git a/src/Data/Trackers/ConnectedServices/DoctrineDbal/Versioned/DataTracker.php b/src/Data/Trackers/ConnectedServices/DoctrineDbal/CurrentDataTracker.php similarity index 89% rename from src/Data/Trackers/ConnectedServices/DoctrineDbal/Versioned/DataTracker.php rename to src/Data/Trackers/ConnectedServices/DoctrineDbal/CurrentDataTracker.php index 1e6a819..0ff530f 100644 --- a/src/Data/Trackers/ConnectedServices/DoctrineDbal/Versioned/DataTracker.php +++ b/src/Data/Trackers/ConnectedServices/DoctrineDbal/CurrentDataTracker.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned; +namespace SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal; use DateInterval; use DateTimeImmutable; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal\Versioned\DataProvider; +use SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal\CurrentDataProvider; use SimpleSAML\Module\accounting\Data\Trackers\Interfaces\DataTrackerInterface; use SimpleSAML\Module\accounting\Entities\Authentication\Event; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\ModuleConfiguration; -class DataTracker extends DataProvider implements DataTrackerInterface +class CurrentDataTracker extends CurrentDataProvider implements DataTrackerInterface { /** * @throws StoreException diff --git a/src/Data/Trackers/ConnectedServices/DoctrineDbal/Current/DataTracker.php b/src/Data/Trackers/ConnectedServices/DoctrineDbal/VersionedDataTracker.php similarity index 88% rename from src/Data/Trackers/ConnectedServices/DoctrineDbal/Current/DataTracker.php rename to src/Data/Trackers/ConnectedServices/DoctrineDbal/VersionedDataTracker.php index ae18ff1..96013b0 100644 --- a/src/Data/Trackers/ConnectedServices/DoctrineDbal/Current/DataTracker.php +++ b/src/Data/Trackers/ConnectedServices/DoctrineDbal/VersionedDataTracker.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Current; +namespace SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal; use DateInterval; use DateTimeImmutable; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal\Current\DataProvider; +use SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal\VersionedDataProvider; use SimpleSAML\Module\accounting\Data\Trackers\Interfaces\DataTrackerInterface; use SimpleSAML\Module\accounting\Entities\Authentication\Event; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\ModuleConfiguration; -class DataTracker extends DataProvider implements DataTrackerInterface +class VersionedDataTracker extends VersionedDataProvider implements DataTrackerInterface { /** * @throws StoreException diff --git a/src/Entities/Authentication/Event/State/Oidc.php b/src/Entities/Authentication/Event/State/Oidc.php index 3e7df92..a224314 100644 --- a/src/Entities/Authentication/Event/State/Oidc.php +++ b/src/Entities/Authentication/Event/State/Oidc.php @@ -31,7 +31,7 @@ class Oidc extends AbstractState return $oidcState[self::KEY_OPEN_ID_PROVIDER_METADATA]; } - throw new UnexpectedValueException('State array does not contain OpenID DataProvider metadata.'); + throw new UnexpectedValueException('State array does not contain OpenID VersionedDataProvider metadata.'); } protected function resolveIdentityProviderEntityId(): string @@ -43,7 +43,7 @@ class Oidc extends AbstractState return $this->identityProviderMetadata[Identity\Oidc::METADATA_KEY_ENTITY_ID]; } - throw new UnexpectedValueException('OpenID DataProvider metadata array does not contain issuer.'); + throw new UnexpectedValueException('OpenID VersionedDataProvider metadata array does not contain issuer.'); } protected function resolveServiceProviderMetadata(array $state): array diff --git a/src/Entities/ConnectedService.php b/src/Entities/ConnectedService.php index 948e2c5..2a6347b 100644 --- a/src/Entities/ConnectedService.php +++ b/src/Entities/ConnectedService.php @@ -8,7 +8,7 @@ use DateTimeImmutable; use SimpleSAML\Module\accounting\Entities\Interfaces\ServiceProviderInterface; /** - * Represents a Service DataProvider to which a user has authenticated at least once. + * Represents a Service VersionedDataProvider to which a user has authenticated at least once. */ class ConnectedService { diff --git a/src/Entities/Providers/Identity/Oidc.php b/src/Entities/Providers/Identity/Oidc.php index 16df50e..c662f78 100644 --- a/src/Entities/Providers/Identity/Oidc.php +++ b/src/Entities/Providers/Identity/Oidc.php @@ -36,7 +36,7 @@ class Oidc extends AbstractProvider implements IdentityProviderInterface return $this->metadata[self::METADATA_KEY_ENTITY_ID]; } - throw new MetadataException('OpenID DataProvider metadata does not contain entity ID.'); + throw new MetadataException('OpenID VersionedDataProvider metadata does not contain entity ID.'); } public function getProtocol(): AuthenticationProtocolInterface diff --git a/src/Entities/Providers/Service/Oidc.php b/src/Entities/Providers/Service/Oidc.php index 3733230..5f5ff82 100644 --- a/src/Entities/Providers/Service/Oidc.php +++ b/src/Entities/Providers/Service/Oidc.php @@ -38,7 +38,7 @@ class Oidc extends AbstractProvider implements ServiceProviderInterface return $this->metadata[self::METADATA_KEY_ENTITY_ID]; } - throw new MetadataException('Relying DataProvider metadata does not contain entity ID.'); + throw new MetadataException('Relying VersionedDataProvider metadata does not contain entity ID.'); } public function getProtocol(): AuthenticationProtocolInterface diff --git a/src/ModuleConfiguration.php b/src/ModuleConfiguration.php index b1cf744..7926be5 100644 --- a/src/ModuleConfiguration.php +++ b/src/ModuleConfiguration.php @@ -337,7 +337,7 @@ class ModuleConfiguration foreach ($this->getProviderClasses() as $providerClass) { if (!is_subclass_of($providerClass, DataProviderInterface::class)) { $errors[] = sprintf( - 'DataProvider class \'%s\' does not implement interface \'%s\'.', + 'VersionedDataProvider class \'%s\' does not implement interface \'%s\'.', $providerClass, DataProviderInterface::class ); @@ -363,7 +363,7 @@ class ModuleConfiguration $errors[] = 'Additional trackers array must contain class strings only.'; } elseif (!is_subclass_of($trackerClass, DataTrackerInterface::class)) { $errors[] = sprintf( - 'DataTracker class \'%s\' does not implement interface \'%s\'.', + 'VersionedDataTracker class \'%s\' does not implement interface \'%s\'.', $trackerClass, DataTrackerInterface::class ); diff --git a/src/Services/JobRunner.php b/src/Services/JobRunner.php index 65e46f0..f73796c 100644 --- a/src/Services/JobRunner.php +++ b/src/Services/JobRunner.php @@ -312,7 +312,7 @@ class JobRunner } if ($cachedState->getJobRunnerId() !== $this->jobRunnerId) { - $message = 'Current job runner ID differs from the ID in the cached state.'; + $message = 'CurrentDataProvider job runner ID differs from the ID in the cached state.'; throw new Exception($message); } diff --git a/tests/config-templates/config.php b/tests/config-templates/config.php index 5cdba79..d9f238c 100644 --- a/tests/config-templates/config.php +++ b/tests/config-templates/config.php @@ -906,7 +906,7 @@ $config = [ *************************************/ /* - * DataTracker processing filters that will be executed for all IdPs + * VersionedDataTracker processing filters that will be executed for all IdPs */ 'authproc.idp' => [ /* Enable the authproc filter below to add URN prefixes to all attributes @@ -961,7 +961,7 @@ $config = [ ], /* - * DataTracker processing filters that will be executed for all SPs + * VersionedDataTracker processing filters that will be executed for all SPs */ 'authproc.sp' => [ /* diff --git a/tests/config-templates/module_accounting.php b/tests/config-templates/module_accounting.php index c0c0f87..014f2e5 100644 --- a/tests/config-templates/module_accounting.php +++ b/tests/config-templates/module_accounting.php @@ -19,10 +19,10 @@ $config = [ ModuleConfiguration::OPTION_JOBS_STORE => Stores\Jobs\DoctrineDbal\Store::class, ModuleConfiguration::OPTION_PROVIDER_FOR_ACTIVITY => - Providers\Activity\Versioned\DoctrineDbal\DataProvider::class, + Providers\Activity\DoctrineDbal\VersionedDataProvider::class, ModuleConfiguration::OPTION_PROVIDER_FOR_CONNECTED_SERVICES => - Providers\ConnectedServices\DoctrineDbal\Versioned\DataProvider::class, + Providers\ConnectedServices\DoctrineDbal\VersionedDataProvider::class, ModuleConfiguration::OPTION_ADDITIONAL_TRACKERS => [ // @@ -30,13 +30,13 @@ $config = [ ModuleConfiguration::OPTION_CLASS_TO_CONNECTION_MAP => [ Stores\Jobs\DoctrineDbal\Store::class => 'doctrine_dbal_pdo_sqlite', - Providers\Activity\Versioned\DoctrineDbal\DataProvider::class => [ + Providers\Activity\DoctrineDbal\VersionedDataProvider::class => [ ModuleConfiguration\ConnectionType::MASTER => 'doctrine_dbal_pdo_sqlite', ModuleConfiguration\ConnectionType::SLAVE => [ 'doctrine_dbal_pdo_sqlite_slave', ], ], - Providers\ConnectedServices\DoctrineDbal\Versioned\DataProvider::class => [ + Providers\ConnectedServices\DoctrineDbal\VersionedDataProvider::class => [ ModuleConfiguration\ConnectionType::MASTER => 'doctrine_dbal_pdo_sqlite', ModuleConfiguration\ConnectionType::SLAVE => [ 'doctrine_dbal_pdo_sqlite_slave', diff --git a/tests/src/Auth/Process/AccountingTest.php b/tests/src/Auth/Process/AccountingTest.php index 98ea4a8..2db27ba 100644 --- a/tests/src/Auth/Process/AccountingTest.php +++ b/tests/src/Auth/Process/AccountingTest.php @@ -9,10 +9,10 @@ use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use SimpleSAML\Module\accounting\Auth\Process\Accounting; -use SimpleSAML\Module\accounting\Data\Providers\Activity\Versioned\DoctrineDbal\DataProvider; +use SimpleSAML\Module\accounting\Data\Providers\Activity\DoctrineDbal\VersionedDataProvider; use SimpleSAML\Module\accounting\Data\Stores\Builders\JobsStoreBuilder; use SimpleSAML\Module\accounting\Data\Stores\Jobs\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal\DataTracker; +use SimpleSAML\Module\accounting\Data\Trackers\Activity\DoctrineDbal\VersionedDataTracker; use SimpleSAML\Module\accounting\Entities\Authentication\Event; use SimpleSAML\Module\accounting\Exceptions\InvalidConfigurationException; use SimpleSAML\Module\accounting\ModuleConfiguration; @@ -61,7 +61,7 @@ class AccountingTest extends TestCase $this->jobsStoreBuilderMock = $this->createMock(JobsStoreBuilder::class); $this->jobsStoreMock = $this->createMock(Store::class); - $this->trackerMock = $this->createMock(DataTracker::class); + $this->trackerMock = $this->createMock(VersionedDataTracker::class); $this->sampleState = StateArrays::SAML2_FULL; @@ -134,7 +134,7 @@ class AccountingTest extends TestCase ->willReturn(ModuleConfiguration\AccountingProcessingType::VALUE_SYNCHRONOUS); $this->moduleConfigurationStub->method('getProviderClasses') - ->willReturn([DataProvider::class]); + ->willReturn([VersionedDataProvider::class]); $this->moduleConfigurationStub->method('getAdditionalTrackers')->willReturn([]); $this->jobsStoreBuilderMock->expects($this->never()) diff --git a/tests/src/Constants/RawRowResult.php b/tests/src/Constants/RawRowResult.php index 45ecab9..faa0e7e 100644 --- a/tests/src/Constants/RawRowResult.php +++ b/tests/src/Constants/RawRowResult.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace SimpleSAML\Test\Module\accounting\Constants; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\TableConstants as ActivityTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\TableConstants as ActivityTableConstants; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants as ConnectedServicesTableConstants; class RawRowResult diff --git a/tests/src/Data/Providers/Builders/DataProviderBuilderTest.php b/tests/src/Data/Providers/Builders/DataProviderBuilderTest.php index 1de01d6..7b2b5ac 100644 --- a/tests/src/Data/Providers/Builders/DataProviderBuilderTest.php +++ b/tests/src/Data/Providers/Builders/DataProviderBuilderTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use SimpleSAML\Module\accounting\Data\Providers\Builders\DataProviderBuilder; -use SimpleSAML\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal\DataTracker; +use SimpleSAML\Module\accounting\Data\Trackers\Activity\DoctrineDbal\VersionedDataTracker; use SimpleSAML\Module\accounting\Exceptions\Exception; use SimpleSAML\Module\accounting\ModuleConfiguration; use SimpleSAML\Module\accounting\Services\HelpersManager; @@ -21,17 +21,17 @@ use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractStore * @uses \SimpleSAML\Module\accounting\Data\Stores\Builders\DataStoreBuilder * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store - * @uses \SimpleSAML\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal\DataTracker + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store + * @uses \SimpleSAML\Module\accounting\Data\Trackers\Activity\DoctrineDbal\VersionedDataTracker * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator * @uses \SimpleSAML\Module\accounting\Services\HelpersManager * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\AbstractStore - * @uses \SimpleSAML\Module\accounting\Data\Providers\Activity\Versioned\DoctrineDbal\DataProvider - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Providers\Activity\DoctrineDbal\VersionedDataProvider + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository */ class DataProviderBuilderTest extends TestCase { @@ -74,7 +74,7 @@ class DataProviderBuilderTest extends TestCase $this->helpersManager ); - $this->assertInstanceOf(DataTracker::class, $builder->build(DataTracker::class)); + $this->assertInstanceOf(VersionedDataTracker::class, $builder->build(VersionedDataTracker::class)); } public function testThrowsForInvalidClass(): void diff --git a/tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000700CreateAuthenticationEventTableTest.php b/tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000700CreateAuthenticationEventTableTest.php similarity index 96% rename from tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000700CreateAuthenticationEventTableTest.php rename to tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000700CreateAuthenticationEventTableTest.php index 98a0382..c1a790d 100644 --- a/tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/Migrations/Version20220801000700CreateAuthenticationEventTableTest.php +++ b/tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/Migrations/Version20220801000700CreateAuthenticationEventTableTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000700CreateAuthenticationEventTable + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000700CreateAuthenticationEventTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection */ diff --git a/tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RawActivityTest.php b/tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RawActivityTest.php similarity index 95% rename from tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RawActivityTest.php rename to tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RawActivityTest.php index 958f839..73f3322 100644 --- a/tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RawActivityTest.php +++ b/tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RawActivityTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; use DateTimeImmutable; use Doctrine\DBAL\Platforms\AbstractPlatform; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\RawActivity; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\TableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\RawActivity; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Entities\Authentication\Protocol\Saml2; use SimpleSAML\Module\accounting\Exceptions\UnexpectedValueException; use SimpleSAML\Test\Module\accounting\Constants\DateTime; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\RawActivity + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\RawActivity * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractRawEntity */ class RawActivityTest extends TestCase @@ -62,7 +62,10 @@ class RawActivityTest extends TestCase { $rawActivity = new RawActivity($this->rawRow, $this->abstractPlatformStub); - $this->assertInstanceOf(RawActivity::class, $rawActivity); + $this->assertInstanceOf( + RawActivity::class, + $rawActivity + ); } public function testCanGetProperties(): void diff --git a/tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RepositoryTest.php b/tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RepositoryTest.php similarity index 91% rename from tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RepositoryTest.php rename to tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RepositoryTest.php index b610167..fbf3b36 100644 --- a/tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/Store/RepositoryTest.php +++ b/tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/Store/RepositoryTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; use DateInterval; use DateTimeImmutable; @@ -10,13 +10,13 @@ use Exception; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Repository; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants + as BaseTableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Repository; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants - as BaseTableConstants; use SimpleSAML\Module\accounting\Entities\Authentication\Protocol\Saml2; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; @@ -25,29 +25,29 @@ use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; use SimpleSAML\Test\Module\accounting\Constants\DateTime; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Repository + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Helpers\Filesystem * @uses \SimpleSAML\Module\accounting\ModuleConfiguration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000000CreateIdpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000100CreateIdpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000200CreateSpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000300CreateSpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000400CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000500CreateUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000600CreateIdpSpUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000700CreateAuthenticationEventTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpSpUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000000CreateIdpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000100CreateIdpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000200CreateSpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000300CreateSpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000400CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000500CreateUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000600CreateIdpSpUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000700CreateAuthenticationEventTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpSpUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Services\HelpersManager */ class RepositoryTest extends TestCase @@ -70,7 +70,7 @@ class RepositoryTest extends TestCase protected string $userIdentifierHash; protected string $userAttributes; protected string $userAttributesHash; - protected Store\Repository $repository; + protected Repository $repository; protected DateTimeImmutable $createdAt; /** * @var Stub @@ -101,8 +101,8 @@ class RepositoryTest extends TestCase 'Stores' . DIRECTORY_SEPARATOR . 'Accounting' . DIRECTORY_SEPARATOR . 'Activity' . DIRECTORY_SEPARATOR . - 'Versioned' . DIRECTORY_SEPARATOR . 'DoctrineDbal' . DIRECTORY_SEPARATOR . + 'Versioned' . DIRECTORY_SEPARATOR . 'Store' . DIRECTORY_SEPARATOR . AbstractMigrator::DEFAULT_MIGRATIONS_DIRECTORY_NAME; $namespace = Store::class . '\\' . AbstractMigrator::DEFAULT_MIGRATIONS_DIRECTORY_NAME; @@ -148,7 +148,7 @@ class RepositoryTest extends TestCase public function testInsertAuthenticationEventThrowsOnInvalidDbal(): void { $this->connectionStub->method('dbal')->willThrowException(new Exception('test')); - $repository = new Store\Repository($this->connectionStub, $this->loggerStub); + $repository = new Repository($this->connectionStub, $this->loggerStub); $this->expectException(StoreException::class); $repository->insertAuthenticationEvent(1, $this->createdAt); diff --git a/tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/StoreTest.php b/tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/StoreTest.php similarity index 92% rename from tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/StoreTest.php rename to tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/StoreTest.php index 766b898..d86650e 100644 --- a/tests/src/Data/Stores/Accounting/Activity/Versioned/DoctrineDbal/StoreTest.php +++ b/tests/src/Data/Stores/Accounting/Activity/DoctrineDbal/Versioned/StoreTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned; use DateTimeImmutable; use Doctrine\DBAL\Result; @@ -11,11 +11,11 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\TableConstants; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\TableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants as BaseTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator; @@ -30,35 +30,35 @@ use SimpleSAML\Test\Module\accounting\Constants\RawRowResult; use SimpleSAML\Test\Module\accounting\Constants\StateArrays; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractStore * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Entities\Authentication\Event * @uses \SimpleSAML\Module\accounting\Entities\Bases\AbstractState * @uses \SimpleSAML\Module\accounting\Entities\Authentication\Event\State\Saml2 * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000000CreateIdpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000100CreateIdpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000200CreateSpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000300CreateSpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000400CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000500CreateUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000600CreateIdpSpUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Migrations\Version20220801000700CreateAuthenticationEventTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000000CreateIdpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000100CreateIdpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000200CreateSpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000300CreateSpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000400CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000500CreateUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000600CreateIdpSpUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Migrations\Version20220801000700CreateAuthenticationEventTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpSpUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpSpUserVersionTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\AbstractStore * @uses \SimpleSAML\Module\accounting\Helpers\Filesystem * @uses \SimpleSAML\Module\accounting\Helpers\Hash @@ -71,7 +71,7 @@ use SimpleSAML\Test\Module\accounting\Constants\StateArrays; * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractRawEntity * @uses \SimpleSAML\Module\accounting\Entities\Activity\Bag * @uses \SimpleSAML\Module\accounting\Entities\Activity - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\RawActivity + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\RawActivity * @uses \SimpleSAML\Module\accounting\Services\HelpersManager * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\AbstractStore * @uses \SimpleSAML\Module\accounting\Entities\Providers\Service\Saml2 diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpSpUserVersionTableTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpSpUserVersionTableTest.php similarity index 94% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpSpUserVersionTableTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpSpUserVersionTableTest.php index 2f13d4f..cba763e 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpSpUserVersionTableTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpSpUserVersionTableTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpSpUserVersionTable + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpSpUserVersionTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection */ diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpTableTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpTableTest.php similarity index 94% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpTableTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpTableTest.php index e57524d..41792f8 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpTableTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpTableTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection */ diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpVersionTableTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpVersionTableTest.php similarity index 94% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpVersionTableTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpVersionTableTest.php index 6d9599a..cc8c079 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateIdpVersionTableTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateIdpVersionTableTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpVersionTable + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpVersionTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection * */ diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpTableTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpTableTest.php similarity index 94% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpTableTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpTableTest.php index 6b9c0e0..a388427 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpTableTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpTableTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection */ diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpVersionTableTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpVersionTableTest.php similarity index 94% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpVersionTableTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpVersionTableTest.php index fe2d6a8..44e4151 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateSpVersionTableTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateSpVersionTableTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpVersionTable + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpVersionTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection */ diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserTableTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserTableTest.php similarity index 94% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserTableTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserTableTest.php index 732eb0e..786ff8b 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserTableTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserTableTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; @@ -16,7 +16,7 @@ use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations\Version20220801000400CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection */ diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserVersionTableTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserVersionTableTest.php similarity index 94% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserVersionTableTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserVersionTableTest.php index 210b780..a151504 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/Migrations/CreateUserVersionTableTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/Migrations/CreateUserVersionTableTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\Exceptions\StoreException\MigrationException; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserVersionTable + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserVersionTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection */ diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/RepositoryTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/RepositoryTest.php similarity index 94% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/RepositoryTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/RepositoryTest.php index c515e9c..2007a26 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/RepositoryTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/Store/RepositoryTest.php @@ -2,17 +2,17 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store; use DateTimeImmutable; use Exception; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants as BaseTableConstants; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository; use SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator; @@ -24,20 +24,20 @@ use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; use SimpleSAML\Test\Module\accounting\Constants\DateTime; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Helpers\Filesystem * @uses \SimpleSAML\Module\accounting\ModuleConfiguration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpSpUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpSpUserVersionTable * @uses \SimpleSAML\Module\accounting\Services\HelpersManager */ class RepositoryTest extends TestCase @@ -91,8 +91,8 @@ class RepositoryTest extends TestCase 'Stores' . DIRECTORY_SEPARATOR . 'Accounting' . DIRECTORY_SEPARATOR . 'Bases' . DIRECTORY_SEPARATOR . - 'Versioned' . DIRECTORY_SEPARATOR . 'DoctrineDbal' . DIRECTORY_SEPARATOR . + 'Versioned' . DIRECTORY_SEPARATOR . 'Store' . DIRECTORY_SEPARATOR . AbstractMigrator::DEFAULT_MIGRATIONS_DIRECTORY_NAME; $namespace = Store::class . '\\' . AbstractMigrator::DEFAULT_MIGRATIONS_DIRECTORY_NAME; diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/StoreTest.php b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/StoreTest.php similarity index 95% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/StoreTest.php rename to tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/StoreTest.php index 15c6861..10c9068 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/StoreTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/DoctrineDbal/Versioned/StoreTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned; use Doctrine\DBAL\Result; use Exception; @@ -10,9 +10,9 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator; @@ -27,27 +27,26 @@ use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; use SimpleSAML\Test\Module\accounting\Constants\StateArrays; /** - * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store + * @covers \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractStore * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Entities\Authentication\Event * @uses \SimpleSAML\Module\accounting\Entities\Bases\AbstractState * @uses \SimpleSAML\Module\accounting\Entities\Authentication\Event\State\Saml2 * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Bases\AbstractMigration - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpSpUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpSpUserVersionTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\AbstractStore * @uses \SimpleSAML\Module\accounting\Helpers\Filesystem * @uses \SimpleSAML\Module\accounting\Helpers\Hash @@ -115,7 +114,7 @@ class StoreTest extends TestCase $this->hashDecoratedState = new HashDecoratedState($this->state); $this->repositoryMock = $this->createMock( - Store\Repository::class + \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository::class ); $this->resultStub = $this->createStub(Result::class); diff --git a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/HashDecoratedStateTest.php b/tests/src/Data/Stores/Accounting/Bases/HashDecoratedStateTest.php similarity index 98% rename from tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/HashDecoratedStateTest.php rename to tests/src/Data/Stores/Accounting/Bases/HashDecoratedStateTest.php index 0a80b9c..0585513 100644 --- a/tests/src/Data/Stores/Accounting/Bases/Versioned/DoctrineDbal/Store/HashDecoratedStateTest.php +++ b/tests/src/Data/Stores/Accounting/Bases/HashDecoratedStateTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\Bases; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; diff --git a/tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/Store/RawConnectedServiceTest.php b/tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/RawConnectedServiceTest.php similarity index 51% rename from tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/Store/RawConnectedServiceTest.php rename to tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/RawConnectedServiceTest.php index a8db934..a9dc48e 100644 --- a/tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/Store/RawConnectedServiceTest.php +++ b/tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/RawConnectedServiceTest.php @@ -2,12 +2,14 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\ConnectedServices\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal; use DateTimeImmutable; use Doctrine\DBAL\Platforms\AbstractPlatform; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Exceptions\UnexpectedValueException; use SimpleSAML\Test\Module\accounting\Constants\DateTime; @@ -43,15 +45,15 @@ class RawConnectedServiceTest extends TestCase $this->serviceProviderMetadata = ['sp' => 'metadata']; $this->userAttributes = ['user' => 'attribute']; $this->rawRow = [ - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS => + TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS => $this->numberOfAuthentications, - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_LAST_AUTHENTICATION_AT => + TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_LAST_AUTHENTICATION_AT => $this->lastAuthenticationAt, - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_FIRST_AUTHENTICATION_AT => + TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_FIRST_AUTHENTICATION_AT => $this->firstAuthenticationAt, - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA => + TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA => serialize($this->serviceProviderMetadata), - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES => + TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES => serialize($this->userAttributes), ]; $this->dateTimeFormat = DateTime::DEFAULT_FORMAT; @@ -63,14 +65,14 @@ class RawConnectedServiceTest extends TestCase public function testCanCreateInstance(): void { $this->assertInstanceOf( - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService::class, - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($this->rawRow, $this->abstractPlatformStub) + RawConnectedService::class, + new RawConnectedService($this->rawRow, $this->abstractPlatformStub) ); } public function testCanGetProperties(): void { - $rawConnectedServiceProvider = new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService( + $rawConnectedServiceProvider = new RawConnectedService( $this->rawRow, $this->abstractPlatformStub ); @@ -93,80 +95,80 @@ class RawConnectedServiceTest extends TestCase public function testThrowsIfColumnNotSet(): void { $rawRow = $this->rawRow; - unset($rawRow[\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES]); + unset($rawRow[TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES]); $this->expectException(UnexpectedValueException::class); - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($rawRow, $this->abstractPlatformStub); + new RawConnectedService($rawRow, $this->abstractPlatformStub); } public function testThrowsIfNumberOfAuthenticationsNotNumeric(): void { $rawRow = $this->rawRow; - $rawRow[\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS] = 'a'; + $rawRow[TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS] = 'a'; $this->expectException(UnexpectedValueException::class); - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($rawRow, $this->abstractPlatformStub); + new RawConnectedService($rawRow, $this->abstractPlatformStub); } public function testThrowsIfLastAuthenticationAtNotString(): void { $rawRow = $this->rawRow; - $rawRow[\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_LAST_AUTHENTICATION_AT] = 1; + $rawRow[TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_LAST_AUTHENTICATION_AT] = 1; $this->expectException(UnexpectedValueException::class); - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($rawRow, $this->abstractPlatformStub); + new RawConnectedService($rawRow, $this->abstractPlatformStub); } public function testThrowsIfFirstAuthenticationAtNotString(): void { $rawRow = $this->rawRow; - $rawRow[\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_FIRST_AUTHENTICATION_AT] = 1; + $rawRow[TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_FIRST_AUTHENTICATION_AT] = 1; $this->expectException(UnexpectedValueException::class); - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($rawRow, $this->abstractPlatformStub); + new RawConnectedService($rawRow, $this->abstractPlatformStub); } public function testThrowsIfSpMetadataNotString(): void { $rawRow = $this->rawRow; - $rawRow[\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] = 1; + $rawRow[TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] = 1; $this->expectException(UnexpectedValueException::class); - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($rawRow, $this->abstractPlatformStub); + new RawConnectedService($rawRow, $this->abstractPlatformStub); } public function testThrowsIfUserAttributesNotString(): void { $rawRow = $this->rawRow; - $rawRow[\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES] = 1; + $rawRow[TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES] = 1; $this->expectException(UnexpectedValueException::class); - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($rawRow, $this->abstractPlatformStub); + new RawConnectedService($rawRow, $this->abstractPlatformStub); } public function testThrowsIfSpMetadataNotValid(): void { $rawRow = $this->rawRow; - $rawRow[\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] = serialize(1); + $rawRow[TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] = serialize(1); $this->expectException(UnexpectedValueException::class); - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($rawRow, $this->abstractPlatformStub); + new RawConnectedService($rawRow, $this->abstractPlatformStub); } public function testThrowsIfUserAttributesNotValid(): void { $rawRow = $this->rawRow; - $rawRow[\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES] = serialize(1); + $rawRow[TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES] = serialize(1); $this->expectException(UnexpectedValueException::class); - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\RawConnectedService($rawRow, $this->abstractPlatformStub); + new RawConnectedService($rawRow, $this->abstractPlatformStub); } } diff --git a/tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/Store/RepositoryTest.php b/tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/RepositoryTest.php similarity index 87% rename from tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/Store/RepositoryTest.php rename to tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/RepositoryTest.php index 769a727..aac9186 100644 --- a/tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/Store/RepositoryTest.php +++ b/tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/Store/RepositoryTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\ConnectedServices\Versioned\DoctrineDbal\Store; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store; use DateInterval; use DateTimeImmutable; @@ -10,7 +10,8 @@ use Exception; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\TableConstants as BaseTableConstants; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\TableConstants + as BaseTableConstants; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Repository; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants; @@ -39,14 +40,14 @@ use SimpleSAML\Test\Module\accounting\Constants\DateTime; * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations\Version20220801000400CreateUserTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations\Version20220801000500CreateUserVersionTable * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations\Version20220801000700CreateConnectedServiceTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpSpUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpSpUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Services\HelpersManager */ class RepositoryTest extends TestCase @@ -69,7 +70,7 @@ class RepositoryTest extends TestCase protected string $userIdentifierHash; protected string $userAttributes; protected string $userAttributesHash; - protected Store\Repository $repository; + protected Repository $repository; protected DateTimeImmutable $createdAt; /** * @var Stub @@ -100,8 +101,8 @@ class RepositoryTest extends TestCase 'Stores' . DIRECTORY_SEPARATOR . 'Accounting' . DIRECTORY_SEPARATOR . 'ConnectedServices' . DIRECTORY_SEPARATOR . - 'Versioned' . DIRECTORY_SEPARATOR . 'DoctrineDbal' . DIRECTORY_SEPARATOR . + 'Versioned' . DIRECTORY_SEPARATOR . 'Store' . DIRECTORY_SEPARATOR . AbstractMigrator::DEFAULT_MIGRATIONS_DIRECTORY_NAME; $namespace = Store::class . '\\' . AbstractMigrator::DEFAULT_MIGRATIONS_DIRECTORY_NAME; @@ -139,8 +140,8 @@ class RepositoryTest extends TestCase public function testCanCreateInstance(): void { $this->assertInstanceOf( - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Repository::class, - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Repository($this->connection, $this->loggerStub) + Repository::class, + new Repository($this->connection, $this->loggerStub) ); } @@ -193,7 +194,7 @@ class RepositoryTest extends TestCase $this->assertEquals( '1', $resultArray[$this->spEntityId] - [Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS] + [TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS] ); $this->assertSame( $this->spMetadata, @@ -203,7 +204,7 @@ class RepositoryTest extends TestCase $this->assertSame( $this->userAttributes, $resultArray[$this->spEntityId] - [\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES] + [TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES] ); $connectedServiceId = (int)$this->repository->getConnectedService($idpSpUserVersionId)->fetchOne(); @@ -218,17 +219,17 @@ class RepositoryTest extends TestCase $this->assertEquals( '2', $resultArray[$this->spEntityId] - [\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS] + [TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_NUMBER_OF_AUTHENTICATIONS] ); $this->assertSame( $this->spMetadata, $resultArray[$this->spEntityId] - [\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] + [TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] ); $this->assertSame( $this->userAttributes, $resultArray[$this->spEntityId] - [\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES] + [TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_USER_ATTRIBUTES] ); // Simulate another SP @@ -262,7 +263,7 @@ class RepositoryTest extends TestCase $this->assertSame( $spMetadataNew, $resultArray[$spEntityIdNew] - [\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] + [TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] ); $this->assertSame( $this->userAttributes, @@ -295,7 +296,7 @@ class RepositoryTest extends TestCase $this->assertSame( $spMetadataNew, $resultArray[$spEntityIdNew] - [\SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] + [TableConstants::ENTITY_CONNECTED_SERVICE_COLUMN_NAME_SP_METADATA] ); // New SP with new user attributes version.. $this->assertSame( @@ -315,7 +316,7 @@ class RepositoryTest extends TestCase public function testGetConnectedServiceProvidersThrowsOnInvalidDbal(): void { $this->connectionStub->method('dbal')->willThrowException(new Exception('test')); - $repository = new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Repository($this->connectionStub, $this->loggerStub); + $repository = new Repository($this->connectionStub, $this->loggerStub); $this->expectException(StoreException::class); $repository->getConnectedServices($this->userIdentifierHash); @@ -374,7 +375,7 @@ class RepositoryTest extends TestCase public function testDeleteAuthenticationEventsOlderThanThrowsOnInvalidDbal(): void { $this->connectionStub->method('dbal')->willThrowException(new Exception('test')); - $repository = new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Repository($this->connectionStub, $this->loggerStub); + $repository = new Repository($this->connectionStub, $this->loggerStub); $this->expectException(StoreException::class); $repository->deleteConnectedServicesOlderThan(new DateTimeImmutable()); diff --git a/tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/StoreTest.php b/tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/StoreTest.php similarity index 85% rename from tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/StoreTest.php rename to tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/StoreTest.php index 3cae4da..3e810e1 100644 --- a/tests/src/Data/Stores/Accounting/ConnectedServices/Versioned/DoctrineDbal/StoreTest.php +++ b/tests/src/Data/Stores/Accounting/ConnectedServices/DoctrineDbal/Versioned/StoreTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\ConnectedServices\Versioned\DoctrineDbal; +namespace SimpleSAML\Test\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned; use DateTimeImmutable; use Doctrine\DBAL\Result; @@ -11,6 +11,8 @@ use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Repository; use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\TableConstants; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection; use SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory; @@ -45,15 +47,15 @@ use SimpleSAML\Test\Module\accounting\Constants\StateArrays; * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Migrations\Version20220801000700CreateConnectedServiceTable * @uses \SimpleSAML\Module\accounting\Helpers\Filesystem * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\HashDecoratedState - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateSpVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Migrations\CreateIdpSpUserVersionTable - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateSpVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Migrations\CreateIdpSpUserVersionTable + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\AbstractStore * @uses \SimpleSAML\Module\accounting\Helpers\Hash * @uses \SimpleSAML\Module\accounting\Helpers\Arr @@ -124,7 +126,7 @@ class StoreTest extends TestCase $this->hashDecoratedState = new HashDecoratedState($this->state); $this->repositoryMock = $this->createMock( - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store\Repository::class + Repository::class ); $this->resultStub = $this->createStub(Result::class); @@ -137,8 +139,8 @@ class StoreTest extends TestCase public function testCanConstructInstance(): void { $this->assertInstanceOf( - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store::class, - new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store( + Store::class, + new Store( $this->moduleConfigurationStub, $this->loggerMock, null, @@ -154,8 +156,8 @@ class StoreTest extends TestCase public function testCanBuildInstance(): void { $this->assertInstanceOf( - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store::class, - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store::build($this->moduleConfigurationStub, $this->loggerMock) + Store::class, + Store::build($this->moduleConfigurationStub, $this->loggerMock) ); } @@ -166,7 +168,7 @@ class StoreTest extends TestCase { $this->repositoryMock->method('getConnectedServices')->willReturn([]); - $store = new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store( + $store = new Store( $this->moduleConfigurationStub, $this->loggerMock, null, @@ -189,7 +191,7 @@ class StoreTest extends TestCase $this->repositoryMock->method('getConnectedServices') ->willReturn([RawRowResult::CONNECTED_SERVICE]); - $store = new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store( + $store = new Store( $this->moduleConfigurationStub, $this->loggerMock, null, @@ -215,7 +217,7 @@ class StoreTest extends TestCase $this->repositoryMock->method('getConnectedServices') ->willReturn([$rawResult]); - $store = new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store( + $store = new Store( $this->moduleConfigurationStub, $this->loggerMock, null, @@ -240,7 +242,7 @@ class StoreTest extends TestCase ->method('deleteConnectedServicesOlderThan') ->with($dateTime); - $store = new \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store( + $store = new Store( $this->moduleConfigurationStub, $this->loggerMock, null, diff --git a/tests/src/Data/Stores/Builders/DataStoreBuilderTest.php b/tests/src/Data/Stores/Builders/DataStoreBuilderTest.php index 4d886bb..91ed81c 100644 --- a/tests/src/Data/Stores/Builders/DataStoreBuilderTest.php +++ b/tests/src/Data/Stores/Builders/DataStoreBuilderTest.php @@ -7,7 +7,7 @@ namespace SimpleSAML\Test\Module\accounting\Data\Stores\Builders; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; use SimpleSAML\Module\accounting\Data\Stores\Builders\DataStoreBuilder; use SimpleSAML\Module\accounting\Exceptions\StoreException; use SimpleSAML\Module\accounting\ModuleConfiguration; @@ -16,20 +16,20 @@ use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** * @covers \SimpleSAML\Module\accounting\Data\Stores\Builders\DataStoreBuilder - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store * @uses \SimpleSAML\Module\accounting\Helpers\InstanceBuilderUsingModuleConfiguration * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractStore * @uses \SimpleSAML\Module\accounting\Data\Stores\Builders\Bases\AbstractStoreBuilder * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Connection * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator * @uses \SimpleSAML\Module\accounting\Services\HelpersManager * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\AbstractStore - * @uses \SimpleSAML\Module\accounting\Data\Providers\Activity\Versioned\DoctrineDbal\DataProvider - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Providers\Activity\DoctrineDbal\VersionedDataProvider + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository */ class DataStoreBuilderTest extends TestCase { diff --git a/tests/src/Data/Trackers/Activity/Versioned/DoctrineDbal/DataTrackerTest.php b/tests/src/Data/Trackers/Activity/DoctrineDbal/Versioned/DataTrackerTest.php similarity index 84% rename from tests/src/Data/Trackers/Activity/Versioned/DoctrineDbal/DataTrackerTest.php rename to tests/src/Data/Trackers/Activity/DoctrineDbal/Versioned/DataTrackerTest.php index efc952e..4a9caee 100644 --- a/tests/src/Data/Trackers/Activity/Versioned/DoctrineDbal/DataTrackerTest.php +++ b/tests/src/Data/Trackers/Activity/DoctrineDbal/Versioned/DataTrackerTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal; +namespace SimpleSAML\Test\Module\accounting\Data\Trackers\Activity\DoctrineDbal\Versioned; use DateInterval; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal\DataTracker; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Trackers\Activity\DoctrineDbal\VersionedDataTracker; use SimpleSAML\Module\accounting\Entities\Activity; use SimpleSAML\Module\accounting\Entities\Authentication\Event; use SimpleSAML\Module\accounting\Exceptions\StoreException; @@ -18,7 +18,7 @@ use SimpleSAML\Module\accounting\ModuleConfiguration; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal\DataTracker + * @covers \SimpleSAML\Module\accounting\Data\Trackers\Activity\DoctrineDbal\VersionedDataTracker * @uses \SimpleSAML\Module\accounting\Helpers\InstanceBuilderUsingModuleConfiguration * @uses \SimpleSAML\Module\accounting\Data\Stores\Builders\Bases\AbstractStoreBuilder * @uses \SimpleSAML\Module\accounting\Data\Stores\Builders\DataStoreBuilder @@ -26,15 +26,15 @@ use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Factory * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\DoctrineDbal\Migrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\DoctrineDbal\AbstractStore - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Activity\DoctrineDbal\Versioned\Store\Repository * @uses \SimpleSAML\Module\accounting\Helpers\Hash * @uses \SimpleSAML\Module\accounting\Services\HelpersManager * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\AbstractStore - * @uses \SimpleSAML\Module\accounting\Data\Providers\Activity\Versioned\DoctrineDbal\DataProvider - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Providers\Activity\DoctrineDbal\VersionedDataProvider + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository */ class DataTrackerTest extends TestCase { @@ -66,8 +66,8 @@ class DataTrackerTest extends TestCase public function testCanCreateInstance(): void { $this->assertInstanceOf( - DataTracker::class, - new DataTracker( + VersionedDataTracker::class, + new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -76,13 +76,13 @@ class DataTrackerTest extends TestCase ); $this->assertInstanceOf( - DataTracker::class, - new DataTracker($this->moduleConfigurationStub, $this->loggerMock) + VersionedDataTracker::class, + new VersionedDataTracker($this->moduleConfigurationStub, $this->loggerMock) ); $this->assertInstanceOf( - DataTracker::class, - DataTracker::build($this->moduleConfigurationStub, $this->loggerMock) + VersionedDataTracker::class, + VersionedDataTracker::build($this->moduleConfigurationStub, $this->loggerMock) ); } @@ -97,7 +97,7 @@ class DataTrackerTest extends TestCase ->method('persist') ->with($authenticationEventStub); - $tracker = new DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -119,7 +119,7 @@ class DataTrackerTest extends TestCase $this->store->expects($this->once()) ->method('runSetup'); - $tracker = new DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -142,7 +142,7 @@ class DataTrackerTest extends TestCase $this->loggerMock->expects($this->once()) ->method('warning'); - $tracker = new DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -162,7 +162,7 @@ class DataTrackerTest extends TestCase ->method('getActivity') ->willReturn($activityBag); - $tracker = new DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -185,7 +185,7 @@ class DataTrackerTest extends TestCase $this->store->expects($this->once()) ->method('deleteDataOlderThan'); - $tracker = new DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, diff --git a/tests/src/Data/Trackers/ConnectedServices/Versioned/DoctrineDbal/DataTrackerTest.php b/tests/src/Data/Trackers/ConnectedServices/DoctrineDbal/Versioned/DataTrackerTest.php similarity index 78% rename from tests/src/Data/Trackers/ConnectedServices/Versioned/DoctrineDbal/DataTrackerTest.php rename to tests/src/Data/Trackers/ConnectedServices/DoctrineDbal/Versioned/DataTrackerTest.php index a3dc78d..29fef34 100644 --- a/tests/src/Data/Trackers/ConnectedServices/Versioned/DoctrineDbal/DataTrackerTest.php +++ b/tests/src/Data/Trackers/ConnectedServices/DoctrineDbal/Versioned/DataTrackerTest.php @@ -2,14 +2,15 @@ declare(strict_types=1); -namespace SimpleSAML\Test\Module\accounting\Data\Trackers\ConnectedServices\Versioned\DoctrineDbal; +namespace SimpleSAML\Test\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned; use DateInterval; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; -use SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker; +use SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store; +use SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\VersionedDataTracker; use SimpleSAML\Module\accounting\Entities\Authentication\Event; use SimpleSAML\Module\accounting\Entities\ConnectedService; use SimpleSAML\Module\accounting\Exceptions\StoreException; @@ -17,7 +18,7 @@ use SimpleSAML\Module\accounting\ModuleConfiguration; use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; /** - * @covers \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker + * @covers \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\VersionedDataTracker * @uses \SimpleSAML\Module\accounting\Helpers\InstanceBuilderUsingModuleConfiguration * @uses \SimpleSAML\Module\accounting\Data\Stores\Builders\Bases\AbstractStoreBuilder * @uses \SimpleSAML\Module\accounting\Data\Stores\Builders\DataStoreBuilder @@ -31,9 +32,9 @@ use SimpleSAML\Test\Module\accounting\Constants\ConnectionParameters; * @uses \SimpleSAML\Module\accounting\Services\HelpersManager * @uses \SimpleSAML\Module\accounting\Data\Stores\Connections\Bases\AbstractMigrator * @uses \SimpleSAML\Module\accounting\Data\Stores\Bases\AbstractStore - * @uses \SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal\Versioned\DataProvider - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store - * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\Versioned\DoctrineDbal\Store\Repository + * @uses \SimpleSAML\Module\accounting\Data\Providers\ConnectedServices\DoctrineDbal\VersionedDataProvider + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store + * @uses \SimpleSAML\Module\accounting\Data\Stores\Accounting\Bases\DoctrineDbal\Versioned\Store\Repository */ class DataTrackerTest extends TestCase { @@ -57,7 +58,7 @@ class DataTrackerTest extends TestCase ->willReturn(ConnectionParameters::DBAL_SQLITE_MEMORY); $this->loggerMock = $this->createMock(LoggerInterface::class); $this->store = $this->createMock( - \SimpleSAML\Module\accounting\Data\Stores\Accounting\ConnectedServices\DoctrineDbal\Versioned\Store::class + Store::class ); } @@ -67,8 +68,8 @@ class DataTrackerTest extends TestCase public function testCanCreateInstance(): void { $this->assertInstanceOf( - \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker::class, - new DataTracker( + VersionedDataTracker::class, + new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -77,13 +78,13 @@ class DataTrackerTest extends TestCase ); $this->assertInstanceOf( - \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker::class, - new \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker($this->moduleConfigurationStub, $this->loggerMock) + VersionedDataTracker::class, + new VersionedDataTracker($this->moduleConfigurationStub, $this->loggerMock) ); $this->assertInstanceOf( - \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker::class, - \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker::build($this->moduleConfigurationStub, $this->loggerMock) + VersionedDataTracker::class, + VersionedDataTracker::build($this->moduleConfigurationStub, $this->loggerMock) ); } @@ -98,7 +99,7 @@ class DataTrackerTest extends TestCase ->method('persist') ->with($authenticationEventStub); - $tracker = new \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -120,7 +121,7 @@ class DataTrackerTest extends TestCase $this->store->expects($this->once()) ->method('runSetup'); - $tracker = new DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -143,7 +144,7 @@ class DataTrackerTest extends TestCase $this->loggerMock->expects($this->once()) ->method('warning'); - $tracker = new \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -163,7 +164,7 @@ class DataTrackerTest extends TestCase ->method('getConnectedServices') ->willReturn($connectedOrganizationsBagStub); - $tracker = new \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, @@ -186,7 +187,7 @@ class DataTrackerTest extends TestCase $this->store->expects($this->once()) ->method('deleteDataOlderThan'); - $tracker = new \SimpleSAML\Module\accounting\Data\Trackers\ConnectedServices\DoctrineDbal\Versioned\DataTracker( + $tracker = new VersionedDataTracker( $this->moduleConfigurationStub, $this->loggerMock, ModuleConfiguration\ConnectionType::MASTER, diff --git a/tests/src/ModuleConfigurationTest.php b/tests/src/ModuleConfigurationTest.php index 86a0960..77a9114 100644 --- a/tests/src/ModuleConfigurationTest.php +++ b/tests/src/ModuleConfigurationTest.php @@ -6,14 +6,13 @@ namespace SimpleSAML\Test\Module\accounting; use PHPUnit\Framework\TestCase; use SimpleSAML\Configuration; -use SimpleSAML\Module\accounting\Data\Providers\Activity\Versioned\DoctrineDbal\DataProvider; +use SimpleSAML\Module\accounting\Data\Providers\Activity\DoctrineDbal\VersionedDataProvider; +use SimpleSAML\Module\accounting\Data\Stores; use SimpleSAML\Module\accounting\Data\Stores\Interfaces\JobsStoreInterface; use SimpleSAML\Module\accounting\Data\Stores\Jobs\DoctrineDbal\Store; -use SimpleSAML\Module\accounting\Data\Trackers\Activity\Versioned\DoctrineDbal\DataTracker; +use SimpleSAML\Module\accounting\Data\Trackers; use SimpleSAML\Module\accounting\Exceptions\InvalidConfigurationException; use SimpleSAML\Module\accounting\ModuleConfiguration; -use SimpleSAML\Module\accounting\Data\Stores; -use SimpleSAML\Module\accounting\Data\Trackers; use stdClass; /** @@ -111,7 +110,7 @@ class ModuleConfigurationTest extends TestCase $this->assertSame( 'doctrine_dbal_pdo_sqlite_slave', $this->moduleConfiguration->getClassConnectionKey( - DataProvider::class, + VersionedDataProvider::class, ModuleConfiguration\ConnectionType::SLAVE ) ); diff --git a/tests/src/Services/JobRunnerTest.php b/tests/src/Services/JobRunnerTest.php index 7d8ebd6..35b4002 100644 --- a/tests/src/Services/JobRunnerTest.php +++ b/tests/src/Services/JobRunnerTest.php @@ -642,7 +642,7 @@ class JobRunnerTest extends TestCase $this->cacheMock->expects($this->once())->method('delete'); $this->loggerMock->expects($this->once())->method('warning') - ->with($this->stringContains('Current job runner ID differs from the ID in the cached state.')); + ->with($this->stringContains('CurrentDataProvider job runner ID differs from the ID in the cached state.')); $jobRunner = new JobRunner( $this->moduleConfigurationStub, -- GitLab