diff --git a/CHANGELOG.md b/CHANGELOG.md index aa953bd64..deae4c9e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 16.0.0 +- [BREAKING] [#38](https://github.com/shopware/SwagMigrationAssistant/pull/38) feat!: add migration logging required fields +- [BREAKING] [#40](https://github.com/shopware/SwagMigrationAssistant/pull/40) refactor!: add migration logging optional fields +- [BREAKING] [#43](https://github.com/shopware/SwagMigrationAssistant/pull/43) refactor!: migration connection usage + # 15.0.3 - Fixed translations of error groups missing details like the entity - Fixed handling of customers without default payment method in SW6.7 migrations diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index 639bea015..bb81e7eeb 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,8 @@ +# 16.0.0 +- [BREAKING] [#38](https://github.com/shopware/SwagMigrationAssistant/pull/38) feat!: Erforderliche Felder für Migrationsprotokollierung hinzufügen +- [BREAKING] [#40](https://github.com/shopware/SwagMigrationAssistant/pull/40) refactor!: Optionale Felder für Migrationsprotokollierung hinzufügen +- [BREAKING] [#43](https://github.com/shopware/SwagMigrationAssistant/pull/43) refactor!: Nutzung der Migrationsverbindung + # 15.0.3 - Übersetzungen von Fehlergruppen behoben, welche Details wie den Entitätsnamen nicht darstellten - Fehler bei Kunden ohne Standardzahlungsmethode in SW6.7 Migrationen behoben diff --git a/UPGRADE.md b/UPGRADE.md index df5a396fe..efde4f2d8 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,3 +1,72 @@ +# 16.0.0 + +- [BREAKING] [#38](https://github.com/shopware/SwagMigrationAssistant/pull/38) - feat!: add migration logging required fields + - [BREAKING] Truncated database entries of `swag_migration_logging` with `SwagMigrationAssistant\Core\Migration\Migration1754896654TruncateMigrationLogs` + - [BREAKING] Deleted columns `title`, `description`, `paramenters`, `title_snippet`, `description_snippet`, `entity` and `source_id` from `swag_migration_logging` with `SwagMigrationAssistant\Core\Migration\Migration1754897550AddRequiredFieldsToMigrationLogs` + - [BREAKING] Removed fields `title`, `description`, `parameters`, `title_snippet`, `description_snippet`, `entity` and `source_id` from log definition `SwagMigrationAssistant\Migration\Logging\SwagMigrationLoggingDefinition` + - [BREAKING] Removed properties `title`, `description`, `parameters`, `titleSnippet`, `descriptionSnippet`, `entity` and `sourceId` from log entity `SwagMigrationAssistant\Migration\Logging\SwagMigrationLoggingEntity` + - [BREAKING] Removed aggregations of `titleSnippet`, `entity` and `level` in `SwagMigrationAssistant\Migration\History\HistoryService` + - [BREAKING] Updated all log implementations in `SwagMigrationAssistant\Migration\Logging\Log\*` and `SwagMigrationAssistant\Profile\**\Logging\*`: + - deleted methods `getTitle()`, `getTitleSnippet()`, `getDescription()`, `getDescriptionSnippet()`, `getParameters()`, `getSourceId()` + - add method `isUserFixable()` + - Added columns `profile_name`, `gateway_name` and `user_fixable` to `swag_migration_logging` with `SwagMigrationAssistant\Core\Migration\Migration1754897550AddRequiredFieldsToMigrationLogs` + - Added fields `profile_name`, `gateway_name` and `user_fixable` to log definition `SwagMigrationAssistant\Migration\Logging\SwagMigrationLoggingDefinition` + - Added properties `profileName`, `gatewayName` and `userFixable` to log entity `SwagMigrationAssistant\Migration\Logging\SwagMigrationLoggingEntity` + +- [BREAKING] [#40](https://github.com/shopware/SwagMigrationAssistant/pull/40) - refactor!: add migration logging optional fields + - [BREAKING] Replaced `SwagMigrationAssistant\Migration\Logging\Log\BaseRunLogEntity` with `SwagMigrationAssistant\Migration\Logging\Log\Builder\AbstractSwagMigrationLogEntry` + - [BREAKING] Replaced `SwagMigrationAssistant\Migration\Logging\Log\LogEntryInterface` with `SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogEntry` + - [BREAKING] Updated all log implementations in `SwagMigrationAssistant\Migration\Logging\Log\*` and `SwagMigrationAssistant\Profile\**\Logging\*`: + - extend `SwagMigrationAssistant\Migration\Logging\Log\Builder\AbstractSwagMigrationLogEntry` instead of `SwagMigrationAssistant\Migration\Logging\Log\BaseRunLogEntity` + - implement `SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogEntry` instead of `SwagMigrationAssistant\Migration\Logging\Log\LogEntryInterface` + - mark class readonly + - [BREAKING] Renamed log classes to include `Log` suffix + - `SwagMigrationAssistant\Migration\Logging\LogCannotConvertChildEntity`, + - `SwagMigrationAssistant\Migration\Logging\LogCannotConvertEntity`, + - `SwagMigrationAssistant\Migration\Logging\LogDocumentTypeNotSupported`, + - `SwagMigrationAssistant\Migration\Logging\LogInvalidUnserializedData`, + - `SwagMigrationAssistant\Migration\Logging\LogInvalidUnserializedData`, + - `SwagMigrationAssistant\Migration\Logging\LogRunAbortedAutomatically` + - `SwagMigrationAssistant\Migration\Logging\LogUnsupportedObjectType` + - [BREAKING] Change method `addLogEntry()` of `SwagMigrationAssistant\Migration\Logging\LoggingServiceInterface` and implementation `LoggingService` to require `SwagMigrationLogEntry` as parameter instead of `LogEntryInterface` + - Created `SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder` to build log entries of type `SwagMigrationLogEntry` + - Added columns to `swag_migration_logging` with `SwagMigrationAssistant\Core\Migration\Migration1754897550AddRequiredFieldsToMigrationLogs`: + - `entity_name` + - `field_name` + - `field_source_path` + - `source_data` + - `converted_data` + - `used_mapping` + - `exception_message` + - `exception_trace` + - Added fields to `swag_migration_logging` to log definition `SwagMigrationAssistant\Migration\Logging\SwagMigrationLoggingDefinition`: + - `entity_name` + - `field_name` + - `field_source_path` + - `source_data` + - `converted_data` + - `used_mapping` + - `exception_message` + - `exception_trace` + - Added properties and methods to log entity `SwagMigrationAssistant\Migration\Logging\SwagMigrationLoggingEntity`: + - `entityName` and `getEntityName()` + - `fieldName` and `getFieldName()` + - `fieldSourcePath` and `getFieldSourcePath()` + - `sourceData` and `getSourceData()` + - `convertedData` and `getConvertedData()` + - `usedMapping` and `getUsedMapping()` + - `exceptionMessage` and `getExceptionMessage()` + - `exceptionTrace` and `getExceptionTrace()` + +- [BREAKING] [#43](https://github.com/shopware/SwagMigrationAssistant/pull/43) refactor!: migration connection usage + - Changed signature of method `supports()` in `SwagMigrationAssistant\Migration\Gateway\GatewayInterface` to require `ProfileInterface` as parameter instead of `MigrationContextInterface` + - Changed signature of method `getGateways()` in `SwagMigrationAssistant\Migration\Gateway\GatewayRegistryInterface` to require `ProfileInterface` as parameter instead of `MigrationContextInterface` + - Changed signature of method `getGateways()` in `SwagMigrationAssistant\Migration\Gateway\GatewayRegistry` to require `ProfileInterface` as parameter instead of `MigrationContextInterface` + - Changed signature of constructor method of `SwagMigrationAssistant\Migration\MigrationContext` to require `SwagMigrationConnectionEntity` and additional optional parameter of `ProfileInterface` with default value `null` + - Added methods `setProfile()`, `getGateway()`, `setGateway()` and `setConnection()` to `SwagMigrationAssistant\Migration\MigrationContextInterface` + - Added methods `setProfile()`, `getGateway()`, `setGateway()` and `setConnection()` to `SwagMigrationAssistant\Migration\MigrationContext` + - Added null checks to methods `getProfile()` and `getGateway()` in `SwagMigrationAssistant\Migration\MigrationContext` to ensure that a profile and gateway is set before usage + # 14.0.0 - [BREAKING] MIG-1053 - Removed ability to set the `verify` flag for the guzzle API client. This is now always true by default. - [BREAKING] MIG-1053 - Refactored both Shopware 5 and Shopware 6 EnvironmentReader classes to provide more information about exceptions. diff --git a/phpstan.neon.dist b/phpstan.neon.dist index cfb461fc5..6eba37fa9 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -54,16 +54,6 @@ parameters: paths: - tests/**/*Test.php - - # TODO remove with #11883 - message: '#Strict comparison using === between SwagMigrationAssistant\\Migration\\Connection\\SwagMigrationConnectionEntity and null will always evaluate to false\.#' - paths: - - **/*.php - - - # TODO remove with #11883 - message: '#Strict comparison using !== between SwagMigrationAssistant\\Migration\\Connection\\SwagMigrationConnectionEntity and null will always evaluate to true\.#' - paths: - - **/*.php - rules: # Shopware core rules - Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Deprecation\DeprecatedMethodsThrowDeprecationRule diff --git a/src/Controller/StatusController.php b/src/Controller/StatusController.php index 4239acd5e..cdd95de87 100644 --- a/src/Controller/StatusController.php +++ b/src/Controller/StatusController.php @@ -87,8 +87,8 @@ public function getProfileInformation(Request $request): Response return new Response(); } - $migrationContext = $this->migrationContextFactory->createByProfileName($profileName); - $gateways = $this->gatewayRegistry->getGateways($migrationContext); + $profile = $this->profileRegistry->getProfile($profileName); + $gateways = $this->gatewayRegistry->getGateways($profile); $currentGateway = null; foreach ($gateways as $gateway) { @@ -151,8 +151,8 @@ public function getGateways(Request $request): JsonResponse throw RoutingException::missingRequestParameter('profileName'); } - $migrationContext = $this->migrationContextFactory->createByProfileName($profileName); - $gateways = $this->gatewayRegistry->getGateways($migrationContext); + $profile = $this->profileRegistry->getProfile($profileName); + $gateways = $this->gatewayRegistry->getGateways($profile); $gatewayNames = []; foreach ($gateways as $gateway) { diff --git a/src/Migration/Converter/Converter.php b/src/Migration/Converter/Converter.php index 5c4ee2cc2..c5460def6 100644 --- a/src/Migration/Converter/Converter.php +++ b/src/Migration/Converter/Converter.php @@ -76,7 +76,8 @@ protected function updateMainMapping(MigrationContextInterface $migrationContext $dataSet = $migrationContext->getDataSet(); $connection = $migrationContext->getConnection(); - if ($dataSet === null || $connection === null) { + + if ($dataSet === null) { return; } diff --git a/src/Migration/Converter/ConverterRegistry.php b/src/Migration/Converter/ConverterRegistry.php index 77a328830..86a11f66e 100644 --- a/src/Migration/Converter/ConverterRegistry.php +++ b/src/Migration/Converter/ConverterRegistry.php @@ -33,11 +33,6 @@ public function getConverter(MigrationContextInterface $migrationContext): Conve } } - $connection = $migrationContext->getConnection(); - if ($connection === null) { - throw MigrationException::migrationContextPropertyMissing('Connection'); - } - - throw MigrationException::converterNotFound($connection->getProfileName()); + throw MigrationException::converterNotFound($migrationContext->getProfile()->getName()); } } diff --git a/src/Migration/Gateway/GatewayInterface.php b/src/Migration/Gateway/GatewayInterface.php index ff489dd40..f875cb65f 100644 --- a/src/Migration/Gateway/GatewayInterface.php +++ b/src/Migration/Gateway/GatewayInterface.php @@ -11,6 +11,7 @@ use Shopware\Core\Framework\Log\Package; use SwagMigrationAssistant\Migration\EnvironmentInformation; use SwagMigrationAssistant\Migration\MigrationContextInterface; +use SwagMigrationAssistant\Migration\Profile\ProfileInterface; use SwagMigrationAssistant\Migration\TotalStruct; #[Package('fundamentals@after-sales')] @@ -23,7 +24,7 @@ public function getSnippetName(): string; /** * Identifier for a gateway registry */ - public function supports(MigrationContextInterface $migrationContext): bool; + public function supports(ProfileInterface $profile): bool; /** * Reads the given entity type from via context from its connection and returns the data diff --git a/src/Migration/Gateway/GatewayRegistry.php b/src/Migration/Gateway/GatewayRegistry.php index 7ba39d663..87074edd8 100644 --- a/src/Migration/Gateway/GatewayRegistry.php +++ b/src/Migration/Gateway/GatewayRegistry.php @@ -10,6 +10,7 @@ use Shopware\Core\Framework\Log\Package; use SwagMigrationAssistant\Exception\MigrationException; use SwagMigrationAssistant\Migration\MigrationContextInterface; +use SwagMigrationAssistant\Migration\Profile\ProfileInterface; #[Package('fundamentals@after-sales')] class GatewayRegistry implements GatewayRegistryInterface @@ -24,11 +25,11 @@ public function __construct(private readonly iterable $gateways) /** * @return GatewayInterface[] */ - public function getGateways(MigrationContextInterface $migrationContext): array + public function getGateways(ProfileInterface $profile): array { $gateways = []; foreach ($this->gateways as $gateway) { - if ($gateway->supports($migrationContext)) { + if ($gateway->supports($profile)) { $gateways[] = $gateway; } } @@ -39,15 +40,11 @@ public function getGateways(MigrationContextInterface $migrationContext): array public function getGateway(MigrationContextInterface $migrationContext): GatewayInterface { $connection = $migrationContext->getConnection(); - if ($connection === null) { - throw MigrationException::migrationContextPropertyMissing('Connection'); - } - $profileName = $connection->getProfileName(); $gatewayName = $connection->getGatewayName(); foreach ($this->gateways as $gateway) { - if ($gateway->supports($migrationContext) && $gateway->getName() === $gatewayName) { + if ($gateway->supports($migrationContext->getProfile()) && $gateway->getName() === $gatewayName) { return $gateway; } } diff --git a/src/Migration/Gateway/GatewayRegistryInterface.php b/src/Migration/Gateway/GatewayRegistryInterface.php index 9a6eb5548..9391bcd71 100644 --- a/src/Migration/Gateway/GatewayRegistryInterface.php +++ b/src/Migration/Gateway/GatewayRegistryInterface.php @@ -9,6 +9,7 @@ use Shopware\Core\Framework\Log\Package; use SwagMigrationAssistant\Migration\MigrationContextInterface; +use SwagMigrationAssistant\Migration\Profile\ProfileInterface; #[Package('fundamentals@after-sales')] interface GatewayRegistryInterface @@ -16,7 +17,7 @@ interface GatewayRegistryInterface /** * @return GatewayInterface[] */ - public function getGateways(MigrationContextInterface $migrationContext): array; + public function getGateways(ProfileInterface $profile): array; /** * Selects the correct gateway by the given migration context diff --git a/src/Migration/Media/MediaFileProcessorRegistry.php b/src/Migration/Media/MediaFileProcessorRegistry.php index eb2cd770d..44b431fd2 100644 --- a/src/Migration/Media/MediaFileProcessorRegistry.php +++ b/src/Migration/Media/MediaFileProcessorRegistry.php @@ -9,7 +9,6 @@ use Shopware\Core\Framework\Log\Package; use SwagMigrationAssistant\Exception\MigrationException; -use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionEntity; use SwagMigrationAssistant\Migration\MigrationContextInterface; #[Package('fundamentals@after-sales')] @@ -34,10 +33,10 @@ public function getProcessor(MigrationContextInterface $migrationContext): Media } $connection = $migrationContext->getConnection(); - if ($connection === null) { - throw MigrationException::entityNotExists(SwagMigrationConnectionEntity::class, $migrationContext->getRunUuid()); - } - throw MigrationException::processorNotFound($connection->getProfileName(), $connection->getGatewayName()); + throw MigrationException::processorNotFound( + $connection->getProfileName(), + $connection->getGatewayName() + ); } } diff --git a/src/Migration/MessageQueue/Handler/Processor/AbortingProcessor.php b/src/Migration/MessageQueue/Handler/Processor/AbortingProcessor.php index 467a4c490..bf2a1773d 100644 --- a/src/Migration/MessageQueue/Handler/Processor/AbortingProcessor.php +++ b/src/Migration/MessageQueue/Handler/Processor/AbortingProcessor.php @@ -10,7 +10,6 @@ use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Log\Package; -use SwagMigrationAssistant\Exception\MigrationException; use SwagMigrationAssistant\Migration\Data\SwagMigrationDataCollection; use SwagMigrationAssistant\Migration\Media\SwagMigrationMediaFileCollection; use SwagMigrationAssistant\Migration\MessageQueue\Message\MigrationProcessMessage; @@ -59,10 +58,6 @@ public function process( MigrationProgress $progress, ): void { $connection = $migrationContext->getConnection(); - if ($connection === null) { - throw MigrationException::noConnectionFound(); - } - $this->runService->cleanupMappingChecksums($connection->getId(), $context); $this->runTransitionService->forceTransitionToRunStep($migrationContext->getRunUuid(), MigrationStep::CLEANUP); diff --git a/src/Migration/MigrationContext.php b/src/Migration/MigrationContext.php index 1ba4cbc30..547f63dff 100644 --- a/src/Migration/MigrationContext.php +++ b/src/Migration/MigrationContext.php @@ -9,6 +9,7 @@ use Shopware\Core\Framework\Log\Package; use Shopware\Core\Framework\Struct\Struct; +use SwagMigrationAssistant\Exception\MigrationException; use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionEntity; use SwagMigrationAssistant\Migration\DataSelection\DataSet\DataSet; use SwagMigrationAssistant\Migration\Gateway\GatewayInterface; @@ -19,48 +20,55 @@ class MigrationContext extends Struct implements MigrationContextInterface { final public const SOURCE_CONTEXT = 'MIGRATION_CONNECTION_CHECK_FOR_RUNNING_MIGRATION'; - private ProfileInterface $profile; - - private ?SwagMigrationConnectionEntity $connection; - - private string $runUuid; + public function __construct( + private SwagMigrationConnectionEntity $connection, + private ?ProfileInterface $profile = null, + private ?GatewayInterface $gateway = null, + private ?DataSet $dataSet = null, + private readonly string $runUuid = '', + private int $offset = 0, + private int $limit = 0, + ) { + } - private ?DataSet $dataSet; + public function getProfile(): ProfileInterface + { + if ($this->profile === null) { + throw MigrationException::migrationContextPropertyMissing('profile'); + } - private int $offset; + return $this->profile; + } - private int $limit; + public function setProfile(ProfileInterface $profile): void + { + $this->profile = $profile; + } - private GatewayInterface $gateway; + public function getGateway(): GatewayInterface + { + if ($this->gateway === null) { + throw MigrationException::migrationContextPropertyMissing('gateway'); + } - public function __construct( - ProfileInterface $profile, - ?SwagMigrationConnectionEntity $connection = null, - string $runUuid = '', - ?DataSet $dataSet = null, - int $offset = 0, - int $limit = 0, - ) { - $this->profile = $profile; - $this->connection = $connection; - $this->runUuid = $runUuid; - $this->dataSet = $dataSet; - $this->offset = $offset; - $this->limit = $limit; + return $this->gateway; } - public function getProfile(): ProfileInterface + public function setGateway(GatewayInterface $gateway): void { - return $this->profile; + $this->gateway = $gateway; } public function getConnection(): SwagMigrationConnectionEntity { - \assert($this->connection instanceof SwagMigrationConnectionEntity); - return $this->connection; } + public function setConnection(SwagMigrationConnectionEntity $connection): void + { + $this->connection = $connection; + } + public function getRunUuid(): string { return $this->runUuid; @@ -81,18 +89,18 @@ public function getOffset(): int return $this->offset; } - public function getLimit(): int + public function setOffset(int $offset): void { - return $this->limit; + $this->offset = $offset; } - public function getGateway(): GatewayInterface + public function getLimit(): int { - return $this->gateway; + return $this->limit; } - public function setGateway(GatewayInterface $gateway): void + public function setLimit(int $limit): void { - $this->gateway = $gateway; + $this->limit = $limit; } } diff --git a/src/Migration/MigrationContextFactory.php b/src/Migration/MigrationContextFactory.php index db3fe037f..11c7793c0 100644 --- a/src/Migration/MigrationContextFactory.php +++ b/src/Migration/MigrationContextFactory.php @@ -22,18 +22,18 @@ use SwagMigrationAssistant\Migration\Setting\GeneralSettingEntity; #[Package('fundamentals@after-sales')] -class MigrationContextFactory implements MigrationContextFactoryInterface +readonly class MigrationContextFactory implements MigrationContextFactoryInterface { /** * @param EntityRepository $generalSettingRepository * @param EntityRepository $migrationConnectionRepository */ public function __construct( - private readonly ProfileRegistryInterface $profileRegistry, - private readonly GatewayRegistryInterface $gatewayRegistry, - private readonly DataSetRegistryInterface $dataSetRegistry, - private readonly EntityRepository $generalSettingRepository, - private readonly EntityRepository $migrationConnectionRepository, + private ProfileRegistryInterface $profileRegistry, + private GatewayRegistryInterface $gatewayRegistry, + private DataSetRegistryInterface $dataSetRegistry, + private EntityRepository $generalSettingRepository, + private EntityRepository $migrationConnectionRepository, ) { } @@ -44,19 +44,23 @@ public function create( string $entity = '', ): ?MigrationContextInterface { $connection = $run->getConnection(); + if ($connection === null) { return null; } $profile = $this->profileRegistry->getProfile($connection->getProfileName()); + $migrationContext = new MigrationContext( - $profile, $connection, - $run->getId(), + $profile, null, + null, + $run->getId(), $offset, $limit ); + $gateway = $this->gatewayRegistry->getGateway($migrationContext); $migrationContext->setGateway($gateway); @@ -68,25 +72,18 @@ public function create( return $migrationContext; } - public function createByProfileName(string $profileName): MigrationContextInterface - { - $profile = $this->profileRegistry->getProfile($profileName); - - return new MigrationContext( - $profile - ); - } - public function createByConnection( SwagMigrationConnectionEntity $connection, ): MigrationContextInterface { $profile = $this->profileRegistry->getProfile( $connection->getProfileName() ); + $migrationContext = new MigrationContext( + $connection, $profile, - $connection ); + $gateway = $this->gatewayRegistry->getGateway($migrationContext); $migrationContext->setGateway($gateway); @@ -96,6 +93,7 @@ public function createByConnection( public function createBySelectedConnection(Context $context): MigrationContextInterface { $settings = $this->generalSettingRepository->search(new Criteria(), $context)->first(); + if (!$settings instanceof GeneralSettingEntity) { throw MigrationException::entityNotExists(GeneralSettingEntity::class, 'Default'); } @@ -104,9 +102,18 @@ public function createBySelectedConnection(Context $context): MigrationContextIn throw MigrationException::noConnectionIsSelected(); } - $connection = $this->migrationConnectionRepository->search(new Criteria([$settings->getSelectedConnectionId()]), $context)->first(); + $connection = $this->migrationConnectionRepository->search( + new Criteria( + [$settings->getSelectedConnectionId()] + ), + $context + )->first(); + if (!$connection instanceof SwagMigrationConnectionEntity) { - throw MigrationException::entityNotExists(SwagMigrationConnectionEntity::class, $settings->getSelectedConnectionId()); + throw MigrationException::entityNotExists( + SwagMigrationConnectionEntity::class, + $settings->getSelectedConnectionId() + ); } return $this->createByConnection($connection); diff --git a/src/Migration/MigrationContextFactoryInterface.php b/src/Migration/MigrationContextFactoryInterface.php index 234ad85ea..88ed520e9 100644 --- a/src/Migration/MigrationContextFactoryInterface.php +++ b/src/Migration/MigrationContextFactoryInterface.php @@ -17,8 +17,6 @@ interface MigrationContextFactoryInterface { public function create(SwagMigrationRunEntity $run, int $offset = 0, int $limit = 0, string $entity = ''): ?MigrationContextInterface; - public function createByProfileName(string $profileName): MigrationContextInterface; - public function createByConnection(SwagMigrationConnectionEntity $connection): MigrationContextInterface; public function createBySelectedConnection(Context $context): MigrationContextInterface; diff --git a/src/Migration/MigrationContextInterface.php b/src/Migration/MigrationContextInterface.php index b2b893a66..8acac406d 100644 --- a/src/Migration/MigrationContextInterface.php +++ b/src/Migration/MigrationContextInterface.php @@ -18,17 +18,25 @@ interface MigrationContextInterface { public function getProfile(): ProfileInterface; + public function setProfile(ProfileInterface $profile): void; + + public function getGateway(): GatewayInterface; + + public function setGateway(GatewayInterface $gateway): void; + public function getConnection(): SwagMigrationConnectionEntity; + public function setConnection(SwagMigrationConnectionEntity $connection): void; + public function getRunUuid(): string; public function getDataSet(): ?DataSet; public function getOffset(): int; - public function getLimit(): int; + public function setOffset(int $offset): void; - public function getGateway(): GatewayInterface; + public function getLimit(): int; - public function setGateway(GatewayInterface $gateway): void; + public function setLimit(int $limit): void; } diff --git a/src/Migration/Premapping/AbstractPremappingReader.php b/src/Migration/Premapping/AbstractPremappingReader.php index a659af993..fdf173cd8 100644 --- a/src/Migration/Premapping/AbstractPremappingReader.php +++ b/src/Migration/Premapping/AbstractPremappingReader.php @@ -20,12 +20,8 @@ abstract class AbstractPremappingReader implements PremappingReaderInterface protected function fillConnectionPremappingDictionary(MigrationContextInterface $migrationContext): void { - $connection = $migrationContext->getConnection(); - if ($connection === null) { - return; - } + $connectionMapping = $migrationContext->getConnection()->getPremapping(); - $connectionMapping = $connection->getPremapping(); if ($connectionMapping === null) { return; } diff --git a/src/Migration/Service/MigrationDataConverter.php b/src/Migration/Service/MigrationDataConverter.php index 62a0479b1..12383cd2b 100644 --- a/src/Migration/Service/MigrationDataConverter.php +++ b/src/Migration/Service/MigrationDataConverter.php @@ -143,14 +143,13 @@ private function filterDeltas(array $data, ConverterInterface $converter, Migrat $checksums[$converter->getSourceIdentifier($dataSet)] = \md5(\serialize($dataSet)); } - $connection = $migrationContext->getConnection(); $dataSet = $migrationContext->getDataSet(); - if ($connection === null || $dataSet === null) { + if ($dataSet === null) { return new MappingDeltaResult(); } - $connectionId = $connection->getId(); + $connectionId = $migrationContext->getConnection()->getId(); $entity = $dataSet::getEntity(); $result = $this->mappingService->getMappings($connectionId, $entity, \array_keys($checksums), $context); diff --git a/src/Migration/Service/MigrationDataWriter.php b/src/Migration/Service/MigrationDataWriter.php index 4ed4c23a7..a0f003e96 100644 --- a/src/Migration/Service/MigrationDataWriter.php +++ b/src/Migration/Service/MigrationDataWriter.php @@ -129,9 +129,9 @@ public function writeData(MigrationContextInterface $migrationContext, Context $ $migrationContext, $context ); - } catch (\Throwable $exception) { + } catch (\Throwable) { // Worst case: something unknown goes wrong (most likely some foreign key constraint that fails) - $this->writePerEntity($converted, $dataSet::getEntity(), $updateWrittenData, $migrationContext, $context); + $this->writePerEntity($converted, $dataSet::getEntity(), $updateWrittenData, $migrationContext); } finally { // Update written-Flag of the entity in the data table $this->entityWriter->update( @@ -196,7 +196,7 @@ private function handleWriteException( try { $currentWriter->writeData($newData, $this->writeContext); } catch (\Throwable) { - $this->writePerEntity($converted, $entityName, $updateWrittenData, $migrationContext, $context); + $this->writePerEntity($converted, $entityName, $updateWrittenData, $migrationContext); } } @@ -228,7 +228,6 @@ private function writePerEntity( string $entityName, array &$updateWrittenData, MigrationContextInterface $migrationContext, - Context $context, ): void { foreach ($converted as $dataId => $entity) { try { diff --git a/src/Migration/Service/PremappingService.php b/src/Migration/Service/PremappingService.php index 71d5a6f61..fb34741e2 100644 --- a/src/Migration/Service/PremappingService.php +++ b/src/Migration/Service/PremappingService.php @@ -68,10 +68,6 @@ public function writePremapping(Context $context, MigrationContextInterface $mig $connection = $migrationContext->getConnection(); - if ($connection === null) { - return; - } - foreach ($premapping as $item) { $entity = $item['entity']; @@ -118,13 +114,8 @@ public function writePremapping(Context $context, MigrationContextInterface $mig */ private function updateConnectionPremapping(Context $context, MigrationContextInterface $migrationContext, array $premapping): void { - $premapping = $this->updateConnectionPremappingStruct($migrationContext, $premapping); - $connection = $migrationContext->getConnection(); - - if ($connection === null) { - return; - } + $premapping = $this->updateConnectionPremappingStruct($migrationContext, $premapping); $this->connectionRepo->update( [ @@ -144,13 +135,7 @@ private function updateConnectionPremapping(Context $context, MigrationContextIn */ private function updateConnectionPremappingStruct(MigrationContextInterface $migrationContext, array $premapping): array { - $connection = $migrationContext->getConnection(); - - if ($connection === null) { - return []; - } - - $connectionPremapping = $connection->getPremapping(); + $connectionPremapping = $migrationContext->getConnection()->getPremapping(); if ($connectionPremapping === null) { $connectionPremapping = []; diff --git a/src/Profile/Shopware/Converter/AttributeConverter.php b/src/Profile/Shopware/Converter/AttributeConverter.php index 629301665..c1025b69b 100644 --- a/src/Profile/Shopware/Converter/AttributeConverter.php +++ b/src/Profile/Shopware/Converter/AttributeConverter.php @@ -39,12 +39,8 @@ public function convert(array $data, Context $context, MigrationContextInterface $converted = []; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - $this->connectionName = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - $this->connectionName = $connection->getName(); - } + $this->connectionId = $connection->getId(); + $this->connectionName = $connection->getName(); $mapping = $this->mappingService->getOrCreateMapping( $this->connectionId, diff --git a/src/Profile/Shopware/Converter/CategoryConverter.php b/src/Profile/Shopware/Converter/CategoryConverter.php index e26fea2f4..6ce10089c 100644 --- a/src/Profile/Shopware/Converter/CategoryConverter.php +++ b/src/Profile/Shopware/Converter/CategoryConverter.php @@ -81,12 +81,8 @@ public function convert( $this->migrationContext = $migrationContext; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - $this->connectionName = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - $this->connectionName = $connection->getName(); - } + $this->connectionId = $connection->getId(); + $this->connectionName = $connection->getName(); if (!isset($data['_locale'])) { $this->loggingService->addLogEntry( // TODO: add optional fields diff --git a/src/Profile/Shopware/Converter/CrossSellingConverter.php b/src/Profile/Shopware/Converter/CrossSellingConverter.php index e1df85531..a66276898 100644 --- a/src/Profile/Shopware/Converter/CrossSellingConverter.php +++ b/src/Profile/Shopware/Converter/CrossSellingConverter.php @@ -36,10 +36,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->runId = $migrationContext->getRunUuid(); $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $converted = []; $this->mainMapping = $this->mappingService->getOrCreateMapping( diff --git a/src/Profile/Shopware/Converter/CurrencyConverter.php b/src/Profile/Shopware/Converter/CurrencyConverter.php index 46fb4df64..37244e277 100644 --- a/src/Profile/Shopware/Converter/CurrencyConverter.php +++ b/src/Profile/Shopware/Converter/CurrencyConverter.php @@ -47,10 +47,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->mainLocale = $data['_locale']; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $currencyUuid = $this->currencyLookup->get($data['currency'], $context); if ($currencyUuid !== null) { diff --git a/src/Profile/Shopware/Converter/CustomerConverter.php b/src/Profile/Shopware/Converter/CustomerConverter.php index eb5471518..4663eac34 100644 --- a/src/Profile/Shopware/Converter/CustomerConverter.php +++ b/src/Profile/Shopware/Converter/CustomerConverter.php @@ -101,12 +101,8 @@ public function convert( $this->migrationContext = $migrationContext; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - $this->connectionName = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - $this->connectionName = $connection->getName(); - } + $this->connectionId = $connection->getId(); + $this->connectionName = $connection->getName(); $fields = $this->checkForEmptyRequiredDataFields($data, $this->requiredDataFieldKeys); diff --git a/src/Profile/Shopware/Converter/CustomerGroupConverter.php b/src/Profile/Shopware/Converter/CustomerGroupConverter.php index b77dcc163..53506e0e7 100644 --- a/src/Profile/Shopware/Converter/CustomerGroupConverter.php +++ b/src/Profile/Shopware/Converter/CustomerGroupConverter.php @@ -44,12 +44,8 @@ public function convert(array $data, Context $context, MigrationContextInterface unset($data['_locale']); $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - $this->connectionName = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - $this->connectionName = $connection->getName(); - } + $this->connectionId = $connection->getId(); + $this->connectionName = $connection->getName(); $this->mainMapping = $this->mappingService->getOrCreateMapping( $this->connectionId, diff --git a/src/Profile/Shopware/Converter/CustomerWishlistConverter.php b/src/Profile/Shopware/Converter/CustomerWishlistConverter.php index 516cb3dba..a19ff0aa4 100644 --- a/src/Profile/Shopware/Converter/CustomerWishlistConverter.php +++ b/src/Profile/Shopware/Converter/CustomerWishlistConverter.php @@ -27,10 +27,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->migrationContext = $migrationContext; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $this->mainMapping = $this->mappingService->getOrCreateMapping( $this->connectionId, diff --git a/src/Profile/Shopware/Converter/LanguageConverter.php b/src/Profile/Shopware/Converter/LanguageConverter.php index eba545df3..04822064e 100644 --- a/src/Profile/Shopware/Converter/LanguageConverter.php +++ b/src/Profile/Shopware/Converter/LanguageConverter.php @@ -46,10 +46,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->context = $context; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $languageUuid = $this->languageLookup->get($data['locale'], $context); if ($languageUuid !== null) { diff --git a/src/Profile/Shopware/Converter/MainVariantRelationConverter.php b/src/Profile/Shopware/Converter/MainVariantRelationConverter.php index ced400034..f76cd714a 100644 --- a/src/Profile/Shopware/Converter/MainVariantRelationConverter.php +++ b/src/Profile/Shopware/Converter/MainVariantRelationConverter.php @@ -32,9 +32,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->generateChecksum($data); $this->context = $context; $connection = $migrationContext->getConnection(); - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); if (!isset($data['id'], $data['ordernumber'])) { return new ConvertStruct(null, $data); diff --git a/src/Profile/Shopware/Converter/MediaConverter.php b/src/Profile/Shopware/Converter/MediaConverter.php index c7285189e..d6b2e9cf8 100644 --- a/src/Profile/Shopware/Converter/MediaConverter.php +++ b/src/Profile/Shopware/Converter/MediaConverter.php @@ -57,10 +57,7 @@ public function convert( unset($data['_locale']); $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $converted = []; $this->mainMapping = $this->mappingService->getOrCreateMapping( diff --git a/src/Profile/Shopware/Converter/MediaFolderConverter.php b/src/Profile/Shopware/Converter/MediaFolderConverter.php index 30b4bdb25..d7cc78906 100644 --- a/src/Profile/Shopware/Converter/MediaFolderConverter.php +++ b/src/Profile/Shopware/Converter/MediaFolderConverter.php @@ -50,10 +50,7 @@ public function convert(array $data, Context $context, MigrationContextInterface unset($data['_locale']); $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $converted = []; $this->mainMapping = $this->mappingService->getOrCreateMapping( diff --git a/src/Profile/Shopware/Converter/NewsletterRecipientConverter.php b/src/Profile/Shopware/Converter/NewsletterRecipientConverter.php index 8e755c11c..32fc233fe 100644 --- a/src/Profile/Shopware/Converter/NewsletterRecipientConverter.php +++ b/src/Profile/Shopware/Converter/NewsletterRecipientConverter.php @@ -57,10 +57,7 @@ public function convert( MigrationContextInterface $migrationContext, ): ConvertStruct { $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $this->runId = $migrationContext->getRunUuid(); $fields = $this->checkForEmptyRequiredDataFields($data, $this->requiredDataFieldKeys); diff --git a/src/Profile/Shopware/Converter/NumberRangeConverter.php b/src/Profile/Shopware/Converter/NumberRangeConverter.php index 9f75f0202..48e3e4119 100644 --- a/src/Profile/Shopware/Converter/NumberRangeConverter.php +++ b/src/Profile/Shopware/Converter/NumberRangeConverter.php @@ -69,9 +69,6 @@ public function convert(array $data, Context $context, MigrationContextInterface } $connection = $migrationContext->getConnection(); - if ($connection === null) { - return new ConvertStruct(null, $data); - } $this->connectionId = $connection->getId(); if (!\array_key_exists($data['name'], self::TYPE_MAPPING)) { diff --git a/src/Profile/Shopware/Converter/OrderConverter.php b/src/Profile/Shopware/Converter/OrderConverter.php index bf83762fe..3a852bcad 100644 --- a/src/Profile/Shopware/Converter/OrderConverter.php +++ b/src/Profile/Shopware/Converter/OrderConverter.php @@ -120,12 +120,8 @@ public function convert( $this->migrationContext = $migrationContext; $connection = $migrationContext->getConnection(); - $this->connectionName = ''; - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - $this->connectionName = $connection->getName(); - } + $this->connectionId = $connection->getId(); + $this->connectionName = $connection->getName(); $fields = $this->checkForEmptyRequiredDataFields($data, $this->requiredDataFieldKeys); if (empty($data['billingaddress']['id'])) { diff --git a/src/Profile/Shopware/Converter/OrderDocumentConverter.php b/src/Profile/Shopware/Converter/OrderDocumentConverter.php index 9745d3856..7f1cdc686 100644 --- a/src/Profile/Shopware/Converter/OrderDocumentConverter.php +++ b/src/Profile/Shopware/Converter/OrderDocumentConverter.php @@ -73,12 +73,8 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->context = $context; $connection = $migrationContext->getConnection(); - $this->connectionName = ''; - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - $this->connectionName = $connection->getName(); - } + $this->connectionId = $connection->getId(); + $this->connectionName = $connection->getName(); $oldData = $data; $converted = []; diff --git a/src/Profile/Shopware/Converter/ProductConverter.php b/src/Profile/Shopware/Converter/ProductConverter.php index 7827133e8..f361f85e2 100644 --- a/src/Profile/Shopware/Converter/ProductConverter.php +++ b/src/Profile/Shopware/Converter/ProductConverter.php @@ -138,12 +138,8 @@ public function convert( $this->locale = $data['_locale']; $connection = $migrationContext->getConnection(); - $this->connectionName = ''; - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - $this->connectionName = $connection->getName(); - } + $this->connectionId = $connection->getId(); + $this->connectionName = $connection->getName(); $fields = $this->checkForEmptyRequiredDataFields($data, $this->requiredDataFieldKeys); if (!empty($fields)) { diff --git a/src/Profile/Shopware/Converter/ProductOptionRelationConverter.php b/src/Profile/Shopware/Converter/ProductOptionRelationConverter.php index 587823a86..411860f5c 100644 --- a/src/Profile/Shopware/Converter/ProductOptionRelationConverter.php +++ b/src/Profile/Shopware/Converter/ProductOptionRelationConverter.php @@ -34,10 +34,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->originalData = $data; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $productContainerMapping = $this->mappingService->getMapping( $this->connectionId, diff --git a/src/Profile/Shopware/Converter/ProductPropertyRelationConverter.php b/src/Profile/Shopware/Converter/ProductPropertyRelationConverter.php index e1b25099c..55737062e 100644 --- a/src/Profile/Shopware/Converter/ProductPropertyRelationConverter.php +++ b/src/Profile/Shopware/Converter/ProductPropertyRelationConverter.php @@ -37,10 +37,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->originalData = $data; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $productMapping = $this->mappingService->getMapping( $this->connectionId, diff --git a/src/Profile/Shopware/Converter/PromotionConverter.php b/src/Profile/Shopware/Converter/PromotionConverter.php index 54bf3ccce..6e68c4b33 100644 --- a/src/Profile/Shopware/Converter/PromotionConverter.php +++ b/src/Profile/Shopware/Converter/PromotionConverter.php @@ -57,10 +57,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->context = $context; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $converted = []; $this->mainMapping = $this->mappingService->getOrCreateMapping( diff --git a/src/Profile/Shopware/Converter/PropertyGroupOptionConverter.php b/src/Profile/Shopware/Converter/PropertyGroupOptionConverter.php index 97586f041..f1f121031 100644 --- a/src/Profile/Shopware/Converter/PropertyGroupOptionConverter.php +++ b/src/Profile/Shopware/Converter/PropertyGroupOptionConverter.php @@ -73,10 +73,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->runId = $migrationContext->getRunUuid(); $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); if (!isset($data['group']['name'])) { $this->loggingService->addLogEntry( // TODO: add optional fields diff --git a/src/Profile/Shopware/Converter/SalesChannelConverter.php b/src/Profile/Shopware/Converter/SalesChannelConverter.php index 4232a6578..1e911f66e 100644 --- a/src/Profile/Shopware/Converter/SalesChannelConverter.php +++ b/src/Profile/Shopware/Converter/SalesChannelConverter.php @@ -72,10 +72,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->oldIdentifier = $data['id']; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $converted = []; $this->mainMapping = $this->mappingService->getOrCreateMapping( diff --git a/src/Profile/Shopware/Converter/SeoUrlConverter.php b/src/Profile/Shopware/Converter/SeoUrlConverter.php index 3f4099a42..565a5c662 100644 --- a/src/Profile/Shopware/Converter/SeoUrlConverter.php +++ b/src/Profile/Shopware/Converter/SeoUrlConverter.php @@ -44,10 +44,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $originalData = $data; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $converted = []; $this->mainMapping = $this->mappingService->getOrCreateMapping( diff --git a/src/Profile/Shopware/Converter/ShippingMethodConverter.php b/src/Profile/Shopware/Converter/ShippingMethodConverter.php index 1ed8e79ce..0c71b8c60 100644 --- a/src/Profile/Shopware/Converter/ShippingMethodConverter.php +++ b/src/Profile/Shopware/Converter/ShippingMethodConverter.php @@ -90,10 +90,7 @@ public function __construct( public function convert(array $data, Context $context, MigrationContextInterface $migrationContext): ConvertStruct { $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); if (empty($data['id'])) { $this->loggingService->addLogEntry( // TODO: add optional fields diff --git a/src/Profile/Shopware/Converter/ShopwareConverter.php b/src/Profile/Shopware/Converter/ShopwareConverter.php index e01821c5a..b4766d28d 100644 --- a/src/Profile/Shopware/Converter/ShopwareConverter.php +++ b/src/Profile/Shopware/Converter/ShopwareConverter.php @@ -148,7 +148,7 @@ protected function getAttributes( } $connection = $this->migrationContext->getConnection(); - if ($context !== null && $connection !== null) { + if ($context !== null) { $connectionId = $connection->getId(); $mapping = $this->mappingService->getMapping( $connectionId, diff --git a/src/Profile/Shopware/Converter/TranslationConverter.php b/src/Profile/Shopware/Converter/TranslationConverter.php index ed7d7283d..abe5d81e6 100644 --- a/src/Profile/Shopware/Converter/TranslationConverter.php +++ b/src/Profile/Shopware/Converter/TranslationConverter.php @@ -57,10 +57,7 @@ public function convert( $this->runId = $migrationContext->getRunUuid(); $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); if (!isset($data['locale'])) { $this->loggingService->addLogEntry( // TODO: add optional fields @@ -850,12 +847,11 @@ protected function createPropertyOptionTranslation(array $data): ConvertStruct */ protected function addAttribute(string $entityName, string $key, string $value, array &$translation, array &$objectData): void { - $connection = $this->migrationContext->getConnection(); - - if ($connection === null || $value === '') { + if ($value === '') { return; } + $connection = $this->migrationContext->getConnection(); $connectionName = ConnectionNameSanitizer::sanitize($connection->getName()); $isAttribute = \mb_strpos($key, '__attribute_'); @@ -909,7 +905,7 @@ protected function unserializeTranslation(array $data, string $entity): ?array try { $objectData = \unserialize($objectDataSerialized, ['allowed_classes' => false]); - } catch (\Throwable $error) { + } catch (\Throwable) { $objectData = null; } diff --git a/src/Profile/Shopware/Gateway/Api/ShopwareApiGateway.php b/src/Profile/Shopware/Gateway/Api/ShopwareApiGateway.php index 5c93752bb..cf5dcf06c 100644 --- a/src/Profile/Shopware/Gateway/Api/ShopwareApiGateway.php +++ b/src/Profile/Shopware/Gateway/Api/ShopwareApiGateway.php @@ -22,6 +22,7 @@ use SwagMigrationAssistant\Migration\Gateway\Reader\EnvironmentReaderInterface; use SwagMigrationAssistant\Migration\Gateway\Reader\ReaderRegistryInterface; use SwagMigrationAssistant\Migration\MigrationContextInterface; +use SwagMigrationAssistant\Migration\Profile\ProfileInterface; use SwagMigrationAssistant\Profile\Shopware\Gateway\ShopwareGatewayInterface; use SwagMigrationAssistant\Profile\Shopware\Gateway\TableCountReaderInterface; use SwagMigrationAssistant\Profile\Shopware\Gateway\TableReaderInterface; @@ -56,9 +57,9 @@ public function getSnippetName(): string return 'swag-migration.wizard.pages.connectionCreate.gateways.shopwareApi'; } - public function supports(MigrationContextInterface $migrationContext): bool + public function supports(ProfileInterface $profile): bool { - return $migrationContext->getProfile() instanceof ShopwareProfileInterface; + return $profile instanceof ShopwareProfileInterface; } public function read(MigrationContextInterface $migrationContext): array @@ -124,21 +125,7 @@ public function readEnvironmentInformation(MigrationContextInterface $migrationC $environmentDataArray['defaultShopLanguage'] = \str_replace('_', '-', $environmentDataArray['defaultShopLanguage']); $totals = $this->readTotals($migrationContext, $context); - - $connection = $migrationContext->getConnection(); - - if ($connection === null) { - return new EnvironmentInformation( - $profile->getSourceSystemName(), - $profile->getVersion(), - '', - [], - [], - null - ); - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { return new EnvironmentInformation( diff --git a/src/Profile/Shopware/Gateway/Connection/ConnectionFactory.php b/src/Profile/Shopware/Gateway/Connection/ConnectionFactory.php index fa949b6a9..bf9792d2f 100644 --- a/src/Profile/Shopware/Gateway/Connection/ConnectionFactory.php +++ b/src/Profile/Shopware/Gateway/Connection/ConnectionFactory.php @@ -24,13 +24,7 @@ class ConnectionFactory implements ConnectionFactoryInterface, ResetInterface public function createApiClient(MigrationContextInterface $migrationContext): HttpClientInterface { - $connection = $migrationContext->getConnection(); - - if ($connection === null) { - throw MigrationException::noConnectionFound(); - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if (empty($credentials)) { throw MigrationException::invalidConnectionCredentials(); @@ -57,13 +51,7 @@ public function createDatabaseConnection(MigrationContextInterface $migrationCon return $this->externalConnection; } - $connection = $migrationContext->getConnection(); - - if ($connection === null) { - throw MigrationException::noConnectionFound(); - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { throw MigrationException::invalidConnectionCredentials(); diff --git a/src/Profile/Shopware/Gateway/Local/ShopwareLocalGateway.php b/src/Profile/Shopware/Gateway/Local/ShopwareLocalGateway.php index 74ca7e151..c33c087f2 100644 --- a/src/Profile/Shopware/Gateway/Local/ShopwareLocalGateway.php +++ b/src/Profile/Shopware/Gateway/Local/ShopwareLocalGateway.php @@ -22,6 +22,7 @@ use SwagMigrationAssistant\Migration\Gateway\Reader\EnvironmentReaderInterface; use SwagMigrationAssistant\Migration\Gateway\Reader\ReaderRegistry; use SwagMigrationAssistant\Migration\MigrationContextInterface; +use SwagMigrationAssistant\Migration\Profile\ProfileInterface; use SwagMigrationAssistant\Migration\RequestStatusStruct; use SwagMigrationAssistant\Profile\Shopware\Gateway\Connection\ConnectionFactoryInterface; use SwagMigrationAssistant\Profile\Shopware\Gateway\ShopwareGatewayInterface; @@ -57,9 +58,9 @@ public function getSnippetName(): string return 'swag-migration.wizard.pages.connectionCreate.gateways.shopwareLocal'; } - public function supports(MigrationContextInterface $migrationContext): bool + public function supports(ProfileInterface $profile): bool { - return $migrationContext->getProfile() instanceof ShopwareProfileInterface; + return $profile instanceof ShopwareProfileInterface; } public function read(MigrationContextInterface $migrationContext): array diff --git a/src/Profile/Shopware/Media/LocalOrderDocumentProcessor.php b/src/Profile/Shopware/Media/LocalOrderDocumentProcessor.php index 8dffb83bb..e4d52ec39 100644 --- a/src/Profile/Shopware/Media/LocalOrderDocumentProcessor.php +++ b/src/Profile/Shopware/Media/LocalOrderDocumentProcessor.php @@ -66,12 +66,7 @@ public function process( private function getInstallationRoot(MigrationContextInterface $migrationContext): string { - $connection = $migrationContext->getConnection(); - if ($connection === null) { - return ''; - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { return ''; diff --git a/src/Profile/Shopware/Media/LocalProductDownloadProcessor.php b/src/Profile/Shopware/Media/LocalProductDownloadProcessor.php index 39527fcb4..97f68097b 100644 --- a/src/Profile/Shopware/Media/LocalProductDownloadProcessor.php +++ b/src/Profile/Shopware/Media/LocalProductDownloadProcessor.php @@ -71,12 +71,7 @@ public function process( private function getInstallationRoot(MigrationContextInterface $migrationContext): string { - $connection = $migrationContext->getConnection(); - if ($connection === null) { - return ''; - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { return ''; diff --git a/src/Profile/Shopware/Media/Strategy/Md5StrategyResolver.php b/src/Profile/Shopware/Media/Strategy/Md5StrategyResolver.php index 0086edc00..33bfe46fd 100644 --- a/src/Profile/Shopware/Media/Strategy/Md5StrategyResolver.php +++ b/src/Profile/Shopware/Media/Strategy/Md5StrategyResolver.php @@ -24,12 +24,7 @@ public function supports(string $path, MigrationContextInterface $migrationConte public function resolve(string $path, MigrationContextInterface $migrationContext): string { - $connection = $migrationContext->getConnection(); - if ($connection === null) { - return ''; - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { return ''; diff --git a/src/Profile/Shopware/Media/Strategy/PlainStrategyResolver.php b/src/Profile/Shopware/Media/Strategy/PlainStrategyResolver.php index 16381b1e8..31b97845b 100644 --- a/src/Profile/Shopware/Media/Strategy/PlainStrategyResolver.php +++ b/src/Profile/Shopware/Media/Strategy/PlainStrategyResolver.php @@ -20,12 +20,7 @@ public function supports(string $path, MigrationContextInterface $migrationConte public function resolve(string $path, MigrationContextInterface $migrationContext): string { - $connection = $migrationContext->getConnection(); - if ($connection === null) { - return ''; - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { return ''; diff --git a/src/Profile/Shopware/Premapping/DefaultShippingAvailabilityRuleReader.php b/src/Profile/Shopware/Premapping/DefaultShippingAvailabilityRuleReader.php index ee326b4a5..59844bd50 100644 --- a/src/Profile/Shopware/Premapping/DefaultShippingAvailabilityRuleReader.php +++ b/src/Profile/Shopware/Premapping/DefaultShippingAvailabilityRuleReader.php @@ -63,12 +63,7 @@ public function getPremapping(Context $context, MigrationContextInterface $migra protected function fillConnectionPremappingValue(MigrationContextInterface $migrationContext): void { - $connection = $migrationContext->getConnection(); - if ($connection === null) { - return; - } - - $mappingArray = $connection->getPremapping(); + $mappingArray = $migrationContext->getConnection()->getPremapping(); if ($mappingArray === null) { return; diff --git a/src/Profile/Shopware/Premapping/DeliveryTimeReader.php b/src/Profile/Shopware/Premapping/DeliveryTimeReader.php index fcae802c6..735fa78e8 100644 --- a/src/Profile/Shopware/Premapping/DeliveryTimeReader.php +++ b/src/Profile/Shopware/Premapping/DeliveryTimeReader.php @@ -63,12 +63,7 @@ public function getPremapping(Context $context, MigrationContextInterface $migra protected function fillConnectionPremappingValue(MigrationContextInterface $migrationContext): void { - $connection = $migrationContext->getConnection(); - if ($connection === null) { - return; - } - - $mappingArray = $connection->getPremapping(); + $mappingArray = $migrationContext->getConnection()->getPremapping(); if ($mappingArray === null) { return; diff --git a/src/Profile/Shopware/Premapping/NewsletterRecipientStatusReader.php b/src/Profile/Shopware/Premapping/NewsletterRecipientStatusReader.php index 8c758576f..bac7f4f8f 100644 --- a/src/Profile/Shopware/Premapping/NewsletterRecipientStatusReader.php +++ b/src/Profile/Shopware/Premapping/NewsletterRecipientStatusReader.php @@ -47,12 +47,7 @@ public function getPremapping(Context $context, MigrationContextInterface $migra protected function fillConnectionPremappingValue(MigrationContextInterface $migrationContext): void { - $connection = $migrationContext->getConnection(); - if ($connection === null) { - return; - } - - $mappingArray = $connection->getPremapping(); + $mappingArray = $migrationContext->getConnection()->getPremapping(); if ($mappingArray === null) { return; diff --git a/src/Profile/Shopware6/Converter/ShopwareConverter.php b/src/Profile/Shopware6/Converter/ShopwareConverter.php index 8499a7513..d2dcb8d2e 100644 --- a/src/Profile/Shopware6/Converter/ShopwareConverter.php +++ b/src/Profile/Shopware6/Converter/ShopwareConverter.php @@ -48,10 +48,7 @@ public function convert(array $data, Context $context, MigrationContextInterface $this->migrationContext = $migrationContext; $connection = $migrationContext->getConnection(); - $this->connectionId = ''; - if ($connection !== null) { - $this->connectionId = $connection->getId(); - } + $this->connectionId = $connection->getId(); $this->runId = $this->migrationContext->getRunUuid(); diff --git a/src/Profile/Shopware6/Gateway/Api/Shopware6ApiGateway.php b/src/Profile/Shopware6/Gateway/Api/Shopware6ApiGateway.php index 57b1ee52c..030736020 100644 --- a/src/Profile/Shopware6/Gateway/Api/Shopware6ApiGateway.php +++ b/src/Profile/Shopware6/Gateway/Api/Shopware6ApiGateway.php @@ -19,6 +19,7 @@ use SwagMigrationAssistant\Migration\Gateway\Reader\EnvironmentReaderInterface; use SwagMigrationAssistant\Migration\Gateway\Reader\ReaderRegistryInterface; use SwagMigrationAssistant\Migration\MigrationContextInterface; +use SwagMigrationAssistant\Migration\Profile\ProfileInterface; use SwagMigrationAssistant\Profile\Shopware6\Gateway\ShopwareGatewayInterface; use SwagMigrationAssistant\Profile\Shopware6\Gateway\TableReaderInterface; use SwagMigrationAssistant\Profile\Shopware6\Gateway\TotalReaderInterface; @@ -54,9 +55,9 @@ public function getSnippetName(): string return 'swag-migration.wizard.pages.connectionCreate.gateways.shopwareApi'; } - public function supports(MigrationContextInterface $migrationContext): bool + public function supports(ProfileInterface $profile): bool { - return $migrationContext->getProfile() instanceof Shopware6ProfileInterface; + return $profile instanceof Shopware6ProfileInterface; } public function read(MigrationContextInterface $migrationContext): array @@ -83,20 +84,7 @@ public function readEnvironmentInformation(MigrationContextInterface $migrationC ); } - $connection = $migrationContext->getConnection(); - - if ($connection === null) { - return new EnvironmentInformation( - $profile->getSourceSystemName(), - $profile->getVersion(), - '', - [], - [], - null - ); - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { return new EnvironmentInformation( diff --git a/src/Profile/Shopware6/Gateway/Connection/AuthClient.php b/src/Profile/Shopware6/Gateway/Connection/AuthClient.php index ebb2849ee..4f0657632 100644 --- a/src/Profile/Shopware6/Gateway/Connection/AuthClient.php +++ b/src/Profile/Shopware6/Gateway/Connection/AuthClient.php @@ -14,6 +14,7 @@ use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Log\Package; +use SwagMigrationAssistant\Exception\MigrationException; use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionCollection; use SwagMigrationAssistant\Migration\Gateway\HttpClientInterface; use SwagMigrationAssistant\Migration\MigrationContext; @@ -95,16 +96,10 @@ private function setupBearerTokenIfNeeded(): void private function renewBearerToken(): void { - $connection = $this->migrationContext->getConnection(); - - if ($connection === null) { - return; - } - - $credentials = $connection->getCredentialFields(); + $credentials = $this->migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { - return; + throw MigrationException::invalidConnectionCredentials(); } $response = $this->apiClient->post('/api/oauth/token', [ @@ -126,25 +121,20 @@ private function renewBearerToken(): void private function saveBearerToken(): void { $connection = $this->migrationContext->getConnection(); + $credentials = $connection->getCredentialFields(); - if ($connection === null) { - return; - } - - $credentialFields = $connection->getCredentialFields(); - - if ($credentialFields === null) { - return; + if ($credentials === null) { + throw MigrationException::invalidConnectionCredentials(); } $connectionUuid = $connection->getId(); - $credentialFields['bearer_token'] = $this->bearerToken; + $credentials['bearer_token'] = $this->bearerToken; - $this->context->scope(MigrationContext::SOURCE_CONTEXT, function (Context $context) use ($connectionUuid, $credentialFields): void { + $this->context->scope(MigrationContext::SOURCE_CONTEXT, function (Context $context) use ($connectionUuid, $credentials): void { $this->connectionRepository->update([ [ 'id' => $connectionUuid, - 'credentialFields' => $credentialFields, + 'credentialFields' => $credentials, ], ], $context); }); @@ -152,15 +142,7 @@ private function saveBearerToken(): void private function loadBearerToken(): void { - $connection = $this->migrationContext->getConnection(); - - if ($connection === null) { - $this->renewBearerToken(); - - return; - } - - $credentials = $connection->getCredentialFields(); + $credentials = $this->migrationContext->getConnection()->getCredentialFields(); if ($credentials === null) { $this->renewBearerToken(); diff --git a/src/Profile/Shopware6/Gateway/Connection/ConnectionFactory.php b/src/Profile/Shopware6/Gateway/Connection/ConnectionFactory.php index 67e107828..5c6019c1b 100644 --- a/src/Profile/Shopware6/Gateway/Connection/ConnectionFactory.php +++ b/src/Profile/Shopware6/Gateway/Connection/ConnectionFactory.php @@ -29,13 +29,7 @@ public function __construct(private readonly EntityRepository $connectionReposit public function createApiClient(MigrationContextInterface $migrationContext): ?HttpClientInterface { - $connection = $migrationContext->getConnection(); - - if ($connection === null) { - return null; - } - - $credentials = $connection->getCredentialFields(); + $credentials = $migrationContext->getConnection()->getCredentialFields(); if (empty($credentials) || !isset($credentials['endpoint'])) { return null; diff --git a/src/Profile/Shopware6/Media/HttpOrderDocumentGenerationService.php b/src/Profile/Shopware6/Media/HttpOrderDocumentGenerationService.php index 267ab7c76..dae35f759 100644 --- a/src/Profile/Shopware6/Media/HttpOrderDocumentGenerationService.php +++ b/src/Profile/Shopware6/Media/HttpOrderDocumentGenerationService.php @@ -71,13 +71,7 @@ public function process( $mappedWorkload = []; $documentIds = []; $runId = $migrationContext->getRunUuid(); - $connection = $migrationContext->getConnection(); - - if ($connection === null) { - return $workload; - } - - $this->connection = $connection; + $this->connection = $migrationContext->getConnection(); foreach ($workload as $work) { $mappedWorkload[$work->getMediaId()] = $work; diff --git a/tests/LocalConnectionTestCase.php b/tests/LocalConnectionTestCase.php index 08f5d83a3..1d0b01486 100644 --- a/tests/LocalConnectionTestCase.php +++ b/tests/LocalConnectionTestCase.php @@ -70,9 +70,8 @@ abstract protected function getDataSet(): DataSet; protected function setLimitAndOffset(int $limit, int $offset): void { - $reflectionClass = new \ReflectionClass($this->getMigrationContext()); - (new \ReflectionProperty($reflectionClass->getName(), 'limit'))->setValue($this->getMigrationContext(), $limit); - (new \ReflectionProperty($reflectionClass->getName(), 'offset'))->setValue($this->getMigrationContext(), $offset); + $this->getMigrationContext()->setLimit($limit); + $this->getMigrationContext()->setOffset($offset); } protected function getExternalConnection(): Connection @@ -97,15 +96,20 @@ protected function getMigrationContext(): MigrationContextInterface return $this->migrationContext; } + if ($this->migrationConnectionEntity === null) { + throw new \RuntimeException('Migration connection entity is not set. Please call before() method first.'); + } + if ($this->runId === null) { throw new \RuntimeException('RunId is not set. Please call before() method first.'); } $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->migrationConnectionEntity, - $this->runId, + new Shopware55Profile(), + null, $this->getDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Migration/Converter/ConverterRegistryTest.php b/tests/Migration/Converter/ConverterRegistryTest.php index ed8de4d71..5516056c8 100644 --- a/tests/Migration/Converter/ConverterRegistryTest.php +++ b/tests/Migration/Converter/ConverterRegistryTest.php @@ -153,10 +153,11 @@ public function testConverterCollection(ProfileInterface $profile, DataSet $data $connection->setProfileName(Shopware54Profile::PROFILE_NAME); $connection->setGatewayName(ShopwareLocalGateway::GATEWAY_NAME); $migrationContext = new MigrationContext( - $profile, $connection, - Uuid::randomHex(), + $profile, + null, $dataSet, + Uuid::randomHex(), 0, 250 ); @@ -171,10 +172,11 @@ public function testGetConverterNotFound(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $connection->setGatewayName(ShopwareLocalGateway::GATEWAY_NAME); $migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - Uuid::randomHex(), + new Shopware55Profile(), + null, new FooDataSet(), + Uuid::randomHex(), 0, 250 ); diff --git a/tests/Migration/DataSelection/DataSelectionRegistryTest.php b/tests/Migration/DataSelection/DataSelectionRegistryTest.php index bf8a37d33..7b7ed2700 100644 --- a/tests/Migration/DataSelection/DataSelectionRegistryTest.php +++ b/tests/Migration/DataSelection/DataSelectionRegistryTest.php @@ -81,8 +81,8 @@ protected function setUp(): void public function testGetDataSelections(): void { $migrationContext = new MigrationContext( - new Shopware55Profile(), - $this->connection + $this->connection, + new Shopware55Profile() ); $expected = [ @@ -109,8 +109,9 @@ public function testGetDataSelectionsWithOnlyOneDataSelection(): void { $this->dataSelectionRegistry = new DataSelectionRegistry(new DummyCollection([new MediaDataSelection()])); $migrationContext = new MigrationContext( + $this->connection, new Shopware55Profile(), - $this->connection + null ); $dataSelections = $this->dataSelectionRegistry->getDataSelections($migrationContext, $this->environmentInformation); @@ -124,8 +125,9 @@ public function testGetDataSelectionById(): void { $this->dataSelectionRegistry = new DataSelectionRegistry(new DummyCollection([new MediaDataSelection()])); $migrationContext = new MigrationContext( + $this->connection, new Shopware55Profile(), - $this->connection + null ); $dataSelections = $this->dataSelectionRegistry->getDataSelectionsByIds($migrationContext, $this->environmentInformation, ['media']); @@ -137,8 +139,9 @@ public function testGetDataSelectionById(): void public function testEntityNamesRequiredForCount(): void { $migrationContext = new MigrationContext( + $this->connection, new Shopware55Profile(), - $this->connection + null ); $dataSelections = $this->dataSelectionRegistry->getDataSelections($migrationContext, $this->environmentInformation); @@ -154,8 +157,9 @@ public function testEntityNamesRequiredForCount(): void public function testEntityNamesRequiredForCountValues(): void { $migrationContext = new MigrationContext( + $this->connection, new Shopware55Profile(), - $this->connection + null ); $dataSelections = $this->dataSelectionRegistry->getDataSelections($migrationContext, $this->environmentInformation); diff --git a/tests/Migration/DataSelection/DataSetRegistryTest.php b/tests/Migration/DataSelection/DataSetRegistryTest.php index 3b0e99662..2e2cd1a46 100644 --- a/tests/Migration/DataSelection/DataSetRegistryTest.php +++ b/tests/Migration/DataSelection/DataSetRegistryTest.php @@ -47,10 +47,11 @@ protected function setUp(): void public function testSupports(): void { $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new ProductDataSet(), + $this->runId, 0, 250 ); @@ -66,10 +67,11 @@ public function testSupports(): void public function testDataSetNotFound(): void { $migrationContext = new MigrationContext( - new DummyProfile(), $this->connection, - $this->runId, + new DummyProfile(), + null, new FooDataSet(), + $this->runId, 0, 250 ); diff --git a/tests/Migration/Gateway/GatewayServiceTest.php b/tests/Migration/Gateway/GatewayServiceTest.php index 333129198..893b4b8ab 100644 --- a/tests/Migration/Gateway/GatewayServiceTest.php +++ b/tests/Migration/Gateway/GatewayServiceTest.php @@ -38,10 +38,11 @@ public function testGetGatewayNotFound(): void $connection->setCredentialFields([]); $migrationContext = new MigrationContext( - new DummyProfile(), $connection, - '', + new DummyProfile(), + null, new ProductDataSet(), + '', 0, 250 ); diff --git a/tests/Migration/Media/MediaFileProcessorRegistryTest.php b/tests/Migration/Media/MediaFileProcessorRegistryTest.php index b1dbb1735..81fa94c9a 100644 --- a/tests/Migration/Media/MediaFileProcessorRegistryTest.php +++ b/tests/Migration/Media/MediaFileProcessorRegistryTest.php @@ -46,9 +46,9 @@ public function testGetProcessorNotFound(): void $connection->setCredentialFields([]); $context = new MigrationContext( - new Shopware55Profile(), $connection, - '', + new Shopware55Profile(), + null, new FooDataSet() ); $context->setGateway(new DummyLocalGateway()); diff --git a/tests/Migration/Media/Process/HttpDownloadServiceBaseTest.php b/tests/Migration/Media/Process/HttpDownloadServiceBaseTest.php index 478997d72..06ed484a0 100644 --- a/tests/Migration/Media/Process/HttpDownloadServiceBaseTest.php +++ b/tests/Migration/Media/Process/HttpDownloadServiceBaseTest.php @@ -47,10 +47,11 @@ protected function setUp(): void $this->runId = Uuid::randomHex(); $this->loggingService = new DummyLoggingService(); $this->migrationContext = new MigrationContext( - new Shopware6MajorProfile('6.6.0'), new SwagMigrationConnectionEntity(), - Uuid::randomHex(), + new Shopware6MajorProfile('6.6.0'), null, + null, + Uuid::randomHex(), 0, 100 ); diff --git a/tests/Migration/MessageQueue/Handler/MigrationProcessHandlerTest.php b/tests/Migration/MessageQueue/Handler/MigrationProcessHandlerTest.php index 42d647392..fb8f01951 100644 --- a/tests/Migration/MessageQueue/Handler/MigrationProcessHandlerTest.php +++ b/tests/Migration/MessageQueue/Handler/MigrationProcessHandlerTest.php @@ -16,6 +16,7 @@ use Shopware\Core\Framework\Log\Package; use Shopware\Core\Framework\Uuid\Uuid; use SwagMigrationAssistant\Exception\MigrationException; +use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionEntity; use SwagMigrationAssistant\Migration\MessageQueue\Handler\MigrationProcessHandler; use SwagMigrationAssistant\Migration\MessageQueue\Handler\MigrationProcessorRegistry; use SwagMigrationAssistant\Migration\MessageQueue\Handler\Processor\MigrationProcessorInterface; @@ -145,7 +146,10 @@ public function testInvoke(): void ->willReturn($this->createMock(MigrationProcessorInterface::class)); $migrationContextFactory = $this->createMock(MigrationContextFactoryInterface::class); - $migrationContextFactory->method('create')->willReturn(new MigrationContext(new Shopware55Profile())); + $migrationContextFactory->method('create')->willReturn(new MigrationContext( + new SwagMigrationConnectionEntity(), + new Shopware55Profile() + )); $this->migrationProcessHandler = new MigrationProcessHandler( $repository, diff --git a/tests/Migration/MessageQueue/Handler/Processor/AbortingProcessorTest.php b/tests/Migration/MessageQueue/Handler/Processor/AbortingProcessorTest.php index f5d739b6c..a7fd0b5a3 100644 --- a/tests/Migration/MessageQueue/Handler/Processor/AbortingProcessorTest.php +++ b/tests/Migration/MessageQueue/Handler/Processor/AbortingProcessorTest.php @@ -83,7 +83,7 @@ public function testProcessing(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection); + $migrationContext = new MigrationContext($connection, new Shopware55Profile()); $this->processor->process( $migrationContext, diff --git a/tests/Migration/MessageQueue/Handler/Processor/CleanUpProcessorTest.php b/tests/Migration/MessageQueue/Handler/Processor/CleanUpProcessorTest.php index 759bd3631..5f3cd7320 100644 --- a/tests/Migration/MessageQueue/Handler/Processor/CleanUpProcessorTest.php +++ b/tests/Migration/MessageQueue/Handler/Processor/CleanUpProcessorTest.php @@ -58,7 +58,7 @@ public function testProcessing(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection); + $migrationContext = new MigrationContext($connection, new Shopware55Profile()); $this->dbalConnection ->method('executeStatement') diff --git a/tests/Migration/MessageQueue/Handler/Processor/FetchingProcessorTest.php b/tests/Migration/MessageQueue/Handler/Processor/FetchingProcessorTest.php index d01af908c..df7ae7458 100644 --- a/tests/Migration/MessageQueue/Handler/Processor/FetchingProcessorTest.php +++ b/tests/Migration/MessageQueue/Handler/Processor/FetchingProcessorTest.php @@ -59,7 +59,7 @@ public function testProcessingWithoutData(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection); + $migrationContext = new MigrationContext($connection, new Shopware55Profile()); $dataConverter = $this->createMock(MigrationDataConverter::class); $dataConverter @@ -106,7 +106,7 @@ public function testProcessing(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection); + $migrationContext = new MigrationContext($connection, new Shopware55Profile()); $dataFetcher = $this->createMock(MigrationDataFetcher::class); $dataFetcher @@ -159,7 +159,15 @@ public function testProcessWithEmptyResultsShouldContinueWhileEntityTotalIsReach $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection, 'run-uuid', null, 0, 100); + $migrationContext = new MigrationContext( + $connection, + new Shopware55Profile(), + null, + null, + 'run-uuid', + 0, + 100 + ); $dataConverter = $this->createMock(MigrationDataConverter::class); // Method "convert" expected to be called 10 times @@ -219,7 +227,15 @@ public function testProcessShouldAddCurrentDataCountToProgress(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection, 'run-uuid', null, 0, 100); + $migrationContext = new MigrationContext( + $connection, + new Shopware55Profile(), + null, + null, + 'run-uuid', + 0, + 100 + ); $dataConverter = $this->createMock(MigrationDataConverter::class); $dataFetcher = $this->createMock(MigrationDataFetcher::class); diff --git a/tests/Migration/MessageQueue/Handler/Processor/IndexingProcessorTest.php b/tests/Migration/MessageQueue/Handler/Processor/IndexingProcessorTest.php index 94be369d1..09723b7e9 100644 --- a/tests/Migration/MessageQueue/Handler/Processor/IndexingProcessorTest.php +++ b/tests/Migration/MessageQueue/Handler/Processor/IndexingProcessorTest.php @@ -71,7 +71,7 @@ public function testProcessingAndAborting(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection); + $migrationContext = new MigrationContext($connection, new Shopware55Profile()); $runTransitionService = $this->createMock(RunTransitionServiceInterface::class); $runTransitionService @@ -119,7 +119,7 @@ public function testProcessing(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection); + $migrationContext = new MigrationContext($connection, new Shopware55Profile()); $runTransitionService = $this->createMock(RunTransitionServiceInterface::class); $runTransitionService diff --git a/tests/Migration/MessageQueue/Handler/Processor/MediaProcessingProcessorTest.php b/tests/Migration/MessageQueue/Handler/Processor/MediaProcessingProcessorTest.php index 602d994f1..7f7a1c929 100644 --- a/tests/Migration/MessageQueue/Handler/Processor/MediaProcessingProcessorTest.php +++ b/tests/Migration/MessageQueue/Handler/Processor/MediaProcessingProcessorTest.php @@ -67,7 +67,13 @@ public function testProcessingWithoutMediaFiles(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection, $run->getId()); + $migrationContext = new MigrationContext( + $connection, + new Shopware55Profile(), + null, + null, + $run->getId() + ); $runTransitionService = $this->createMock(RunTransitionServiceInterface::class); $runTransitionService @@ -114,7 +120,7 @@ public function testProcessing(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection, $run->getId()); + $migrationContext = new MigrationContext($connection, new Shopware55Profile(), null, null, $run->getId()); $runTransitionService = $this->createMock(RunTransitionServiceInterface::class); $runTransitionService diff --git a/tests/Migration/MessageQueue/Handler/Processor/WritingProcessorTest.php b/tests/Migration/MessageQueue/Handler/Processor/WritingProcessorTest.php index 2663800dc..8c2a2898e 100644 --- a/tests/Migration/MessageQueue/Handler/Processor/WritingProcessorTest.php +++ b/tests/Migration/MessageQueue/Handler/Processor/WritingProcessorTest.php @@ -56,7 +56,7 @@ public function testProcessingWithoutData(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection); + $migrationContext = new MigrationContext($connection, new Shopware55Profile()); $this->processor = new WritingProcessor( $this->createMock(EntityRepository::class), @@ -97,7 +97,7 @@ public function testProcessing(): void $connection = new SwagMigrationConnectionEntity(); $connection->setId(Uuid::randomHex()); - $migrationContext = new MigrationContext(new Shopware55Profile(), $connection); + $migrationContext = new MigrationContext($connection, new Shopware55Profile(), null); $migrationDataWriter = $this->createMock(MigrationDataWriter::class); $migrationDataWriter diff --git a/tests/Migration/Services/MigrationDataProcessingTest.php b/tests/Migration/Services/MigrationDataProcessingTest.php index c5de03b02..061ac313b 100644 --- a/tests/Migration/Services/MigrationDataProcessingTest.php +++ b/tests/Migration/Services/MigrationDataProcessingTest.php @@ -181,10 +181,11 @@ public function testFetchMediaDataApiGateway(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new MediaDataSet(), + $this->runUuid, 0, 250 ); @@ -209,10 +210,11 @@ public function testFetchCategoryDataApiGateway(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new CategoryDataSet(), + $this->runUuid, 0, 250 ); @@ -233,10 +235,11 @@ public function testFetchTranslationDataApiGateway(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new TranslationDataSet(), + $this->runUuid, 0, 250 ); @@ -257,10 +260,11 @@ public function testFetchCustomerDataApiGateway(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new CustomerDataSet(), + $this->runUuid, 0, 250 ); @@ -281,10 +285,11 @@ public function testFetchProductDataApiGateway(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new ProductDataSet(), + $this->runUuid, 0, 250 ); @@ -304,10 +309,11 @@ public function testFetchProductDataLocalGateway(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new ProductDataSet(), + $this->runUuid, 0, 250 ); @@ -327,10 +333,11 @@ public function testFetchInvalidCustomerData(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new InvalidCustomerDataSet(), + $this->runUuid, 0, 250 ); diff --git a/tests/Migration/Services/MigrationDataWriterTest.php b/tests/Migration/Services/MigrationDataWriterTest.php index 4f6ba7501..08cd48c34 100644 --- a/tests/Migration/Services/MigrationDataWriterTest.php +++ b/tests/Migration/Services/MigrationDataWriterTest.php @@ -336,10 +336,11 @@ public static function requiredProperties(): array public function testHandleWriteException(): void { $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new ProductDataSet(), + $this->runUuid, 0, 250 ); @@ -374,10 +375,11 @@ public function testWriteInvalidData(string $missingProperty, bool $mappingExist { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new CustomerDataSet(), + $this->runUuid, 0, 250 ); @@ -428,10 +430,11 @@ public function testWriteSalesChannelData(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new SalesChannelDataSet(), + $this->runUuid, 0, 250 ); @@ -455,10 +458,11 @@ public function testAssignThemeToSalesChannel(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new SalesChannelDataSet(), + $this->runUuid, 0, 250 ); @@ -481,10 +485,11 @@ public function testWriteCustomerData(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new CustomerDataSet(), + $this->runUuid, 0, 250 ); @@ -508,10 +513,11 @@ public function testWriteOrderData(): void $context = Context::createDefaultContext(); // Add users, who have ordered $userMigrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new CustomerDataSet(), + $this->runUuid, 0, 250 ); @@ -526,10 +532,11 @@ public function testWriteOrderData(): void // Add orders $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new OrderDataSet(), + $this->runUuid, 0, 250 ); @@ -556,10 +563,11 @@ public function testWriteMediaData(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new MediaDataSet(), + $this->runUuid, 0, 250 ); @@ -581,10 +589,11 @@ public function testWriteCategoryData(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new CategoryDataSet(), + $this->runUuid, 0, 250 ); @@ -606,10 +615,11 @@ public function testWriteProductData(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new ProductDataSet(), + $this->runUuid, 0, 250 ); @@ -633,10 +643,11 @@ public function testWriteDataWithUnknownWriter(): void { $context = Context::createDefaultContext(); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runUuid, + new Shopware55Profile(), + null, new MediaDataSet(), + $this->runUuid, 0, 250 ); diff --git a/tests/Migration/Services/RunServiceTest.php b/tests/Migration/Services/RunServiceTest.php index a79357c3b..aee974830 100644 --- a/tests/Migration/Services/RunServiceTest.php +++ b/tests/Migration/Services/RunServiceTest.php @@ -123,8 +123,8 @@ protected function setUp(): void $this->migrationContextFactory = $this->createMock(MigrationContextFactory::class); $this->migrationContextFactory->method('createByConnection')->willReturn(new MigrationContext( - new Shopware55Profile(), $connectionEntity, + new Shopware55Profile(), )); $this->dataFetcher = $this->createMock(MigrationDataFetcher::class); diff --git a/tests/Mock/Gateway/Dummy/Local/DummyLocalGateway.php b/tests/Mock/Gateway/Dummy/Local/DummyLocalGateway.php index bafa4c631..e10b350b8 100644 --- a/tests/Mock/Gateway/Dummy/Local/DummyLocalGateway.php +++ b/tests/Mock/Gateway/Dummy/Local/DummyLocalGateway.php @@ -13,6 +13,7 @@ use SwagMigrationAssistant\Migration\EnvironmentInformation; use SwagMigrationAssistant\Migration\Gateway\GatewayInterface; use SwagMigrationAssistant\Migration\MigrationContextInterface; +use SwagMigrationAssistant\Migration\Profile\ProfileInterface; use SwagMigrationAssistant\Migration\TotalStruct; use SwagMigrationAssistant\Profile\Shopware\DataSelection\DataSet\CategoryDataSet; use SwagMigrationAssistant\Profile\Shopware\DataSelection\DataSet\CustomerDataSet; @@ -34,9 +35,9 @@ public function getName(): string return self::GATEWAY_NAME; } - public function supports(MigrationContextInterface $migrationContext): bool + public function supports(ProfileInterface $profile): bool { - return $migrationContext->getProfile() instanceof ShopwareProfileInterface; + return $profile instanceof ShopwareProfileInterface; } public function read(MigrationContextInterface $migrationContext): array diff --git a/tests/Profile/Shopware/Gateway/ApiEnvironmentReaderTest.php b/tests/Profile/Shopware/Gateway/ApiEnvironmentReaderTest.php index 3f00e62f3..1ef0cc180 100644 --- a/tests/Profile/Shopware/Gateway/ApiEnvironmentReaderTest.php +++ b/tests/Profile/Shopware/Gateway/ApiEnvironmentReaderTest.php @@ -19,6 +19,7 @@ use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Log\Package; use SwagMigrationAssistant\Exception\MigrationException; +use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionEntity; use SwagMigrationAssistant\Migration\Gateway\HttpSimpleClient; use SwagMigrationAssistant\Migration\MigrationContext; use SwagMigrationAssistant\Migration\RequestStatusStruct; @@ -42,7 +43,8 @@ public function testEmptyClientReturnsRequestStatus(): void $environmentReader = new EnvironmentReader($connectionFactory); $migrationContext = new MigrationContext( - new Shopware55Profile() + new SwagMigrationConnectionEntity(), + new Shopware55Profile(), ); $response = $environmentReader->read($migrationContext); @@ -81,7 +83,8 @@ public function testResponseExceptions( $client = new HttpSimpleClient($options); $migrationContext = new MigrationContext( - new Shopware55Profile() + new SwagMigrationConnectionEntity(), + new Shopware55Profile(), ); $connectionFactory = $this->createMock(ConnectionFactory::class); @@ -230,6 +233,7 @@ public function testGetsEnvironmentInformation(): void $client = new HttpSimpleClient($options); $migrationContext = new MigrationContext( + new SwagMigrationConnectionEntity(), new Shopware55Profile() ); diff --git a/tests/Profile/Shopware/Gateway/ApiReaderTest.php b/tests/Profile/Shopware/Gateway/ApiReaderTest.php index d83186748..a216ff8b3 100644 --- a/tests/Profile/Shopware/Gateway/ApiReaderTest.php +++ b/tests/Profile/Shopware/Gateway/ApiReaderTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Log\Package; use SwagMigrationAssistant\Exception\GatewayReadException; +use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionEntity; use SwagMigrationAssistant\Migration\Gateway\HttpSimpleClient; use SwagMigrationAssistant\Migration\MigrationContext; use SwagMigrationAssistant\Profile\Shopware\DataSelection\DataSet\ProductDataSet; @@ -49,10 +50,10 @@ public function testRead(): void $client = new HttpSimpleClient($options); $migrationContext = new MigrationContext( + new SwagMigrationConnectionEntity(), new Shopware55Profile(), null, - '', - new ProductDataSet() + new ProductDataSet(), ); $mock = $this->getMockBuilder(ConnectionFactory::class)->getMock(); $mock->expects(static::once()) @@ -81,10 +82,10 @@ public function testReadGatewayException(): void $client = new HttpSimpleClient($options); $migrationContext = new MigrationContext( + new SwagMigrationConnectionEntity(), new Shopware55Profile(), null, - '', - new ProductDataSet() + new ProductDataSet(), ); $mock = $this->getMockBuilder(ConnectionFactory::class)->getMock(); $mock->expects(static::once()) diff --git a/tests/Profile/Shopware/Gateway/Local/CategoryAttributeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/CategoryAttributeReaderTest.php index 83ffa7033..fe0119ad0 100644 --- a/tests/Profile/Shopware/Gateway/Local/CategoryAttributeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/CategoryAttributeReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->categoryAttributeReader = new CategoryAttributeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CategoryAttributeDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/CategoryReaderTest.php b/tests/Profile/Shopware/Gateway/Local/CategoryReaderTest.php index e506b333c..9ec0d3b7c 100644 --- a/tests/Profile/Shopware/Gateway/Local/CategoryReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/CategoryReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->categoryReader = new CategoryReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CategoryDataSet(), + $this->runId, 0, 10 ); @@ -67,10 +68,11 @@ public function testRead(): void static::assertSame('5', $data[3]['previousSiblingId']); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CategoryDataSet(), + $this->runId, 10, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/CurrencyReaderTest.php b/tests/Profile/Shopware/Gateway/Local/CurrencyReaderTest.php index a6971b7e5..835c6beb1 100644 --- a/tests/Profile/Shopware/Gateway/Local/CurrencyReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/CurrencyReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->currencyReader = new CurrencyReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CurrencyDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/CustomerAttributeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/CustomerAttributeReaderTest.php index 4f6521933..6d6d92bdc 100644 --- a/tests/Profile/Shopware/Gateway/Local/CustomerAttributeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/CustomerAttributeReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->customerAttributeReader = new CustomerAttributeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CustomerAttributeDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/CustomerGroupAttributeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/CustomerGroupAttributeReaderTest.php index 23f1d612e..b8c11ea84 100644 --- a/tests/Profile/Shopware/Gateway/Local/CustomerGroupAttributeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/CustomerGroupAttributeReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->customerGroupAttributeReader = new CustomerGroupAttributeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CustomerGroupAttributeDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/CustomerGroupReaderTest.php b/tests/Profile/Shopware/Gateway/Local/CustomerGroupReaderTest.php index aa302e178..011af1857 100644 --- a/tests/Profile/Shopware/Gateway/Local/CustomerGroupReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/CustomerGroupReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->customerGroupReader = new CustomerGroupReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CustomerGroupDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/CustomerReaderTest.php b/tests/Profile/Shopware/Gateway/Local/CustomerReaderTest.php index e7bca9c15..d3272eb1c 100644 --- a/tests/Profile/Shopware/Gateway/Local/CustomerReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/CustomerReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->customerReader = new CustomerReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CustomerDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/EnvironmentReaderTest.php b/tests/Profile/Shopware/Gateway/Local/EnvironmentReaderTest.php index cb9ef173c..7aa4a643b 100644 --- a/tests/Profile/Shopware/Gateway/Local/EnvironmentReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/EnvironmentReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->environmentReader = new EnvironmentReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new CustomerDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/LanguageReaderTest.php b/tests/Profile/Shopware/Gateway/Local/LanguageReaderTest.php index 5ab00f05b..4b8d1c35e 100644 --- a/tests/Profile/Shopware/Gateway/Local/LanguageReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/LanguageReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->languageReader = new LanguageReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new LanguageDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/MainVariantRelationReaderTest.php b/tests/Profile/Shopware/Gateway/Local/MainVariantRelationReaderTest.php index 8dd6eda05..9198d5255 100644 --- a/tests/Profile/Shopware/Gateway/Local/MainVariantRelationReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/MainVariantRelationReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->reader = new MainVariantRelationReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new MainVariantRelationDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/ManufacturerAttributeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/ManufacturerAttributeReaderTest.php index 341a59339..9010f7804 100644 --- a/tests/Profile/Shopware/Gateway/Local/ManufacturerAttributeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/ManufacturerAttributeReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->manufacturerAttributeReader = new ManufacturerAttributeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new ManufacturerAttributeDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/MediaAlbumReaderTest.php b/tests/Profile/Shopware/Gateway/Local/MediaAlbumReaderTest.php index 7f9125920..65fbb257e 100644 --- a/tests/Profile/Shopware/Gateway/Local/MediaAlbumReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/MediaAlbumReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->mediaAlbumReader = new MediaAlbumReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new MediaFolderDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/MediaReaderTest.php b/tests/Profile/Shopware/Gateway/Local/MediaReaderTest.php index 1b5246de9..adb513504 100644 --- a/tests/Profile/Shopware/Gateway/Local/MediaReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/MediaReaderTest.php @@ -35,10 +35,11 @@ protected function setUp(): void $this->mediaReader = new MediaReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new MediaDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/NewsletterRecipientReaderTest.php b/tests/Profile/Shopware/Gateway/Local/NewsletterRecipientReaderTest.php index 9d7daf502..8de05b77b 100644 --- a/tests/Profile/Shopware/Gateway/Local/NewsletterRecipientReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/NewsletterRecipientReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->newsletterRecipientReader = new NewsletterRecipientReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new NewsletterRecipientDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/NumberRangeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/NumberRangeReaderTest.php index 6d670d674..1c6f21118 100644 --- a/tests/Profile/Shopware/Gateway/Local/NumberRangeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/NumberRangeReaderTest.php @@ -33,10 +33,11 @@ protected function setUp(): void $this->numberRangeReader = new NumberRangeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new NumberRangeDataSet(), + $this->runId, 0, 10 ); @@ -86,10 +87,11 @@ public function testReadReturnsLimitedBatchSize(): void static::assertGreaterThan(4, $totalStruct->getTotal()); $migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new NumberRangeDataSet(), + $this->runId, 0, 4 ); diff --git a/tests/Profile/Shopware/Gateway/Local/OrderAttributeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/OrderAttributeReaderTest.php index 2487dafb2..8dd7145a9 100644 --- a/tests/Profile/Shopware/Gateway/Local/OrderAttributeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/OrderAttributeReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->orderAttributeReader = new OrderAttributeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new OrderAttributeDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/OrderDocumentAttributeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/OrderDocumentAttributeReaderTest.php index c0ea7bc9c..870575fe7 100644 --- a/tests/Profile/Shopware/Gateway/Local/OrderDocumentAttributeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/OrderDocumentAttributeReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->orderDocumentAttributeReader = new OrderDocumentAttributeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new OrderDocumentAttributeDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/OrderDocumentReaderTest.php b/tests/Profile/Shopware/Gateway/Local/OrderDocumentReaderTest.php index 0da471419..20cc6a6eb 100644 --- a/tests/Profile/Shopware/Gateway/Local/OrderDocumentReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/OrderDocumentReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->orderDocumentReader = new OrderDocumentReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new OrderDocumentDataSet(), + $this->runId, 0, 5 ); diff --git a/tests/Profile/Shopware/Gateway/Local/OrderReaderTest.php b/tests/Profile/Shopware/Gateway/Local/OrderReaderTest.php index 4e795ec47..368502ca5 100644 --- a/tests/Profile/Shopware/Gateway/Local/OrderReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/OrderReaderTest.php @@ -122,10 +122,11 @@ public function testReadTotal(): void private function createMigrationContext(int $offset, int $limit): void { $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new OrderDataSet(), + $this->runId, $offset, $limit ); diff --git a/tests/Profile/Shopware/Gateway/Local/ProductAttributeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/ProductAttributeReaderTest.php index 13d25323a..a1797b32b 100644 --- a/tests/Profile/Shopware/Gateway/Local/ProductAttributeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/ProductAttributeReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->productAttributeReader = new ProductAttributeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new ProductAttributeDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/ProductPriceAttributeReaderTest.php b/tests/Profile/Shopware/Gateway/Local/ProductPriceAttributeReaderTest.php index 2aa0e5fb0..9ad7d938c 100644 --- a/tests/Profile/Shopware/Gateway/Local/ProductPriceAttributeReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/ProductPriceAttributeReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->productPriceAttributeReader = new ProductPriceAttributeReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new ProductPriceAttributeDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/ProductReviewReaderTest.php b/tests/Profile/Shopware/Gateway/Local/ProductReviewReaderTest.php index d229cb7cf..14dda6870 100644 --- a/tests/Profile/Shopware/Gateway/Local/ProductReviewReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/ProductReviewReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->productReviewReader = new ProductReviewReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new ProductReviewDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/PropertyGroupOptionReaderTest.php b/tests/Profile/Shopware/Gateway/Local/PropertyGroupOptionReaderTest.php index a18ca9964..af8928695 100644 --- a/tests/Profile/Shopware/Gateway/Local/PropertyGroupOptionReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/PropertyGroupOptionReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->propertyGroupOptionReader = new PropertyGroupOptionReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new PropertyGroupOptionDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/SalesChannelReaderTest.php b/tests/Profile/Shopware/Gateway/Local/SalesChannelReaderTest.php index e54ef7832..ce3fe03a0 100644 --- a/tests/Profile/Shopware/Gateway/Local/SalesChannelReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/SalesChannelReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->salesChannelReader = new SalesChannelReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new SalesChannelDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/ShippingMethodReaderTest.php b/tests/Profile/Shopware/Gateway/Local/ShippingMethodReaderTest.php index 854f6a125..37e644baf 100644 --- a/tests/Profile/Shopware/Gateway/Local/ShippingMethodReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/ShippingMethodReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->shippingMethodReader = new ShippingMethodReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new ShippingMethodDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/TableReaderTest.php b/tests/Profile/Shopware/Gateway/Local/TableReaderTest.php index 2d6edb115..de0afda8c 100644 --- a/tests/Profile/Shopware/Gateway/Local/TableReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/TableReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->tableReader = new TableReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new ShippingMethodDataSet(), + $this->runId, 0, 10 ); diff --git a/tests/Profile/Shopware/Gateway/Local/TranslationReaderTest.php b/tests/Profile/Shopware/Gateway/Local/TranslationReaderTest.php index b89c2c52f..180fee8b2 100644 --- a/tests/Profile/Shopware/Gateway/Local/TranslationReaderTest.php +++ b/tests/Profile/Shopware/Gateway/Local/TranslationReaderTest.php @@ -32,10 +32,11 @@ protected function setUp(): void $this->translationReader = new TranslationReader(new ConnectionFactory()); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $this->runId, + new Shopware55Profile(), + null, new TranslationDataSet(), + $this->runId, 50, 10 ); diff --git a/tests/Profile/Shopware/Gateway/LocalGatewayTest.php b/tests/Profile/Shopware/Gateway/LocalGatewayTest.php index 3ff22ac3c..4e6e2d253 100644 --- a/tests/Profile/Shopware/Gateway/LocalGatewayTest.php +++ b/tests/Profile/Shopware/Gateway/LocalGatewayTest.php @@ -54,9 +54,9 @@ public function testReadFailedNoCredentials(string $profileName, ProfileInterfac ); $migrationContext = new MigrationContext( - $profile, $connection, - '', + $profile, + null, new ProductDataSet() ); @@ -105,10 +105,10 @@ public function testReadWithUnknownEntityThrowsException(string $profileName, Pr ); $migrationContext = new MigrationContext( - $profile, $connection, - '', - new FooDataSet() + $profile, + null, + new FooDataSet(), ); $connectionFactory = new ConnectionFactory(); @@ -156,8 +156,8 @@ public function testReadEnvironmentInformationHasEmptyResult(string $profileName $connection->setCredentialFields([]); $migrationContext = new MigrationContext( + $connection, $profile, - $connection ); $readerRegistry = $this->getContainer()->get(ReaderRegistry::class); diff --git a/tests/Profile/Shopware/Gateway/ShopwareApiGatewayTest.php b/tests/Profile/Shopware/Gateway/ShopwareApiGatewayTest.php index bc5f2314b..c4da62be4 100644 --- a/tests/Profile/Shopware/Gateway/ShopwareApiGatewayTest.php +++ b/tests/Profile/Shopware/Gateway/ShopwareApiGatewayTest.php @@ -36,10 +36,11 @@ class ShopwareApiGatewayTest extends TestCase public function testReadFailed(): void { $migrationContext = new MigrationContext( - new Shopware55Profile(), new SwagMigrationConnectionEntity(), - '', - new FooDataSet() + new Shopware55Profile(), + null, + new FooDataSet(), + '' ); $connectionFactory = new ConnectionFactory(); @@ -78,8 +79,8 @@ public function testReadEnvironmentInformationFailed(): void 'apiKey' => 'testing', ]); $migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection ); $connectionFactory = new ConnectionFactory(); @@ -110,8 +111,8 @@ public function testReadEnvironmentInformation(): void $connection->setCredentialFields(['endpoint' => 'foo']); $migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection ); $connectionFactory = new ConnectionFactory(); @@ -141,8 +142,8 @@ public function testReadEnvironmentInformationWithoutSourceDefaultLanguage(): vo $connection->setCredentialFields(['endpoint' => 'foo']); $migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection ); $connectionFactory = new ConnectionFactory(); diff --git a/tests/Profile/Shopware/Premapping/DefaultShippingAvailabilityRuleReaderTest.php b/tests/Profile/Shopware/Premapping/DefaultShippingAvailabilityRuleReaderTest.php index d9d2c2426..2f2867aaa 100644 --- a/tests/Profile/Shopware/Premapping/DefaultShippingAvailabilityRuleReaderTest.php +++ b/tests/Profile/Shopware/Premapping/DefaultShippingAvailabilityRuleReaderTest.php @@ -46,15 +46,18 @@ class DefaultShippingAvailabilityRuleReaderTest extends TestCase protected function setUp(): void { - $this->context = Context::createDefaultContext(); - $this->migrationContext = new MigrationContext(new Shopware55Profile()); - $this->connection = new SwagMigrationConnectionEntity(); $this->connection->setId(Uuid::randomHex()); $this->connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->connection->setGatewayName(ShopwareLocalGateway::GATEWAY_NAME); $this->connection->setCredentialFields([]); + $this->context = Context::createDefaultContext(); + $this->migrationContext = new MigrationContext( + $this->connection, + new Shopware55Profile(), + ); + $this->ruleEntity = new RuleEntity(); $this->ruleEntity->setId(Uuid::randomHex()); $this->ruleEntity->setName('My default rule'); @@ -77,8 +80,9 @@ public function testGetValidPremapping(): void $mock->method('search')->willReturn(new EntitySearchResult(RuleDefinition::ENTITY_NAME, 2, new EntityCollection([$this->ruleEntity, $this->anotherRuleEntity]), null, new Criteria(), $this->context)); $this->migrationContext = new MigrationContext( + $this->connection, new Shopware55Profile(), - $this->connection + null ); $this->reader = new DefaultShippingAvailabilityRuleReader($mock); @@ -107,8 +111,9 @@ public function testGetInvalidPremapping(): void $mock->method('search')->willReturn(new EntitySearchResult(RuleDefinition::ENTITY_NAME, 2, new EntityCollection([$this->ruleEntity, $this->anotherRuleEntity]), null, new Criteria(), $this->context)); $this->migrationContext = new MigrationContext( + $this->connection, new Shopware55Profile(), - $this->connection + null ); $this->reader = new DefaultShippingAvailabilityRuleReader($mock); diff --git a/tests/Profile/Shopware/Premapping/DeliveryTimeReaderTest.php b/tests/Profile/Shopware/Premapping/DeliveryTimeReaderTest.php index 65a60fd4f..5f2c23220 100644 --- a/tests/Profile/Shopware/Premapping/DeliveryTimeReaderTest.php +++ b/tests/Profile/Shopware/Premapping/DeliveryTimeReaderTest.php @@ -71,8 +71,8 @@ protected function setUp(): void $this->deliveryTimeReader = new DeliveryTimeReader($mock); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), - $connection + $connection, + new Shopware55Profile() ); } @@ -104,8 +104,9 @@ public function testGetPremappingInvalidUuid(): void $connection->setPremapping($premapping); $this->migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection + null ); $result = $this->deliveryTimeReader->getPremapping($this->context, $this->migrationContext); diff --git a/tests/Profile/Shopware/Premapping/NewsletterRecipientStatusReaderTest.php b/tests/Profile/Shopware/Premapping/NewsletterRecipientStatusReaderTest.php index 0a54729a7..f94985752 100644 --- a/tests/Profile/Shopware/Premapping/NewsletterRecipientStatusReaderTest.php +++ b/tests/Profile/Shopware/Premapping/NewsletterRecipientStatusReaderTest.php @@ -42,8 +42,8 @@ protected function setUp(): void $this->context = Context::createDefaultContext(); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), - $connection + $connection, + new Shopware55Profile() ); $this->reader = new NewsletterRecipientStatusReader(); diff --git a/tests/Profile/Shopware/Premapping/OrderDeliveryStateReaderTest.php b/tests/Profile/Shopware/Premapping/OrderDeliveryStateReaderTest.php index 9e18cc000..05e2e8ea3 100644 --- a/tests/Profile/Shopware/Premapping/OrderDeliveryStateReaderTest.php +++ b/tests/Profile/Shopware/Premapping/OrderDeliveryStateReaderTest.php @@ -83,8 +83,8 @@ protected function setUp(): void $connection->setPremapping($premapping); $this->migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection ); $gatewayMock = $this->createMock(ShopwareLocalGateway::class); diff --git a/tests/Profile/Shopware/Premapping/OrderStateReaderTest.php b/tests/Profile/Shopware/Premapping/OrderStateReaderTest.php index 58cdd34d5..129543e9c 100644 --- a/tests/Profile/Shopware/Premapping/OrderStateReaderTest.php +++ b/tests/Profile/Shopware/Premapping/OrderStateReaderTest.php @@ -83,8 +83,8 @@ protected function setUp(): void $connection->setPremapping($premapping); $this->migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection ); $gatewayMock = $this->createMock(ShopwareLocalGateway::class); diff --git a/tests/Profile/Shopware/Premapping/PaymentMethodReaderTest.php b/tests/Profile/Shopware/Premapping/PaymentMethodReaderTest.php index 78a2d5700..defe5117c 100644 --- a/tests/Profile/Shopware/Premapping/PaymentMethodReaderTest.php +++ b/tests/Profile/Shopware/Premapping/PaymentMethodReaderTest.php @@ -89,8 +89,8 @@ protected function setUp(): void $gatewayRegistryMock->method('getGateway')->willReturn($gatewayMock); $this->migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection ); $this->reader = new PaymentMethodReader($mock, $gatewayRegistryMock); diff --git a/tests/Profile/Shopware/Premapping/SalutationReaderTest.php b/tests/Profile/Shopware/Premapping/SalutationReaderTest.php index b08463715..072080c85 100644 --- a/tests/Profile/Shopware/Premapping/SalutationReaderTest.php +++ b/tests/Profile/Shopware/Premapping/SalutationReaderTest.php @@ -84,8 +84,9 @@ protected function setUp(): void $gatewayRegistryMock->method('getGateway')->willReturn($gatewayMock); $this->migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection + null ); $this->reader = new SalutationReader($mock, $gatewayRegistryMock); diff --git a/tests/Profile/Shopware/Premapping/TransactionStateReaderTest.php b/tests/Profile/Shopware/Premapping/TransactionStateReaderTest.php index 4834fa5e8..a0703709a 100644 --- a/tests/Profile/Shopware/Premapping/TransactionStateReaderTest.php +++ b/tests/Profile/Shopware/Premapping/TransactionStateReaderTest.php @@ -83,8 +83,9 @@ protected function setUp(): void $connection->setPremapping($premapping); $this->migrationContext = new MigrationContext( + $connection, new Shopware55Profile(), - $connection + null ); $gatewayMock = $this->createMock(ShopwareLocalGateway::class); diff --git a/tests/Profile/Shopware54/Converter/OrderDocumentConverterTest.php b/tests/Profile/Shopware54/Converter/OrderDocumentConverterTest.php index 9e0017e60..a7a69a0f2 100644 --- a/tests/Profile/Shopware54/Converter/OrderDocumentConverterTest.php +++ b/tests/Profile/Shopware54/Converter/OrderDocumentConverterTest.php @@ -74,10 +74,11 @@ protected function setUp(): void $this->connection->setGatewayName(ShopwareLocalGateway::GATEWAY_NAME); $this->connection->setName('shopware'); $this->migrationContext = new MigrationContext( - new Shopware54Profile(), $this->connection, - $this->runId, + new Shopware54Profile(), + null, new OrderDocumentDataSet(), + $this->runId, 0, 250 ); diff --git a/tests/Profile/Shopware54/Converter/ProductConverterTest.php b/tests/Profile/Shopware54/Converter/ProductConverterTest.php index c8cda6693..c35586835 100644 --- a/tests/Profile/Shopware54/Converter/ProductConverterTest.php +++ b/tests/Profile/Shopware54/Converter/ProductConverterTest.php @@ -65,10 +65,11 @@ public function testConvertShouldConvertSeoMainCategories(): void $runId = Uuid::randomHex(); $migrationContext = new MigrationContext( - new Shopware54Profile(), $connection, - $runId, + new Shopware54Profile(), + null, new ProductDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CategoryAttributeConverterTest.php b/tests/Profile/Shopware55/Converter/CategoryAttributeConverterTest.php index 9d65d131a..cb7646a3d 100644 --- a/tests/Profile/Shopware55/Converter/CategoryAttributeConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CategoryAttributeConverterTest.php @@ -39,10 +39,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CategoryAttributeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CategoryConverterTest.php b/tests/Profile/Shopware55/Converter/CategoryConverterTest.php index f998c66c2..abdc073d2 100644 --- a/tests/Profile/Shopware55/Converter/CategoryConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CategoryConverterTest.php @@ -62,10 +62,11 @@ protected function setUp(): void $connection->setName('shopware'); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CategoryDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CrossSellingConverterTest.php b/tests/Profile/Shopware55/Converter/CrossSellingConverterTest.php index 98f6872e7..8c5ae3140 100644 --- a/tests/Profile/Shopware55/Converter/CrossSellingConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CrossSellingConverterTest.php @@ -80,10 +80,11 @@ protected function setUp(): void $this->connection->setName('shopware'); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $runId, + new Shopware55Profile(), + null, new CrossSellingDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CurrencyConverterTest.php b/tests/Profile/Shopware55/Converter/CurrencyConverterTest.php index 47596da9f..66e4dc60f 100644 --- a/tests/Profile/Shopware55/Converter/CurrencyConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CurrencyConverterTest.php @@ -57,10 +57,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CurrencyDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CustomerAttributeConverterTest.php b/tests/Profile/Shopware55/Converter/CustomerAttributeConverterTest.php index 3c6cdb43c..dcb16e6eb 100644 --- a/tests/Profile/Shopware55/Converter/CustomerAttributeConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CustomerAttributeConverterTest.php @@ -37,10 +37,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CustomerAttributeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CustomerConverterTest.php b/tests/Profile/Shopware55/Converter/CustomerConverterTest.php index 0011d904a..d8a76f604 100644 --- a/tests/Profile/Shopware55/Converter/CustomerConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CustomerConverterTest.php @@ -75,10 +75,11 @@ protected function setUp(): void $connection->setGatewayName(ShopwareLocalGateway::GATEWAY_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CustomerDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CustomerGroupAttributeConverterTest.php b/tests/Profile/Shopware55/Converter/CustomerGroupAttributeConverterTest.php index 38cd9509c..54c2d51bf 100644 --- a/tests/Profile/Shopware55/Converter/CustomerGroupAttributeConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CustomerGroupAttributeConverterTest.php @@ -37,10 +37,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CustomerGroupAttributeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CustomerGroupConverterTest.php b/tests/Profile/Shopware55/Converter/CustomerGroupConverterTest.php index 2b6567b2b..a766f6811 100644 --- a/tests/Profile/Shopware55/Converter/CustomerGroupConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CustomerGroupConverterTest.php @@ -58,10 +58,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CustomerGroupDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/CustomerWishlistConverterTest.php b/tests/Profile/Shopware55/Converter/CustomerWishlistConverterTest.php index 03d4d87e0..a8b080157 100644 --- a/tests/Profile/Shopware55/Converter/CustomerWishlistConverterTest.php +++ b/tests/Profile/Shopware55/Converter/CustomerWishlistConverterTest.php @@ -43,10 +43,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CustomerWishlistDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/LanguageConverterTest.php b/tests/Profile/Shopware55/Converter/LanguageConverterTest.php index 45adc5d1e..bee77f357 100644 --- a/tests/Profile/Shopware55/Converter/LanguageConverterTest.php +++ b/tests/Profile/Shopware55/Converter/LanguageConverterTest.php @@ -50,10 +50,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new LanguageDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/MainVariantRelationConverterTest.php b/tests/Profile/Shopware55/Converter/MainVariantRelationConverterTest.php index 60dac08d2..0f8b5c5bf 100644 --- a/tests/Profile/Shopware55/Converter/MainVariantRelationConverterTest.php +++ b/tests/Profile/Shopware55/Converter/MainVariantRelationConverterTest.php @@ -62,10 +62,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new MainVariantRelationDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/ManufacturerAttributeConverterTest.php b/tests/Profile/Shopware55/Converter/ManufacturerAttributeConverterTest.php index 246f0875b..c30a30732 100644 --- a/tests/Profile/Shopware55/Converter/ManufacturerAttributeConverterTest.php +++ b/tests/Profile/Shopware55/Converter/ManufacturerAttributeConverterTest.php @@ -37,10 +37,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new ManufacturerAttributeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/MediaConverterTest.php b/tests/Profile/Shopware55/Converter/MediaConverterTest.php index b2868b60a..c756735da 100644 --- a/tests/Profile/Shopware55/Converter/MediaConverterTest.php +++ b/tests/Profile/Shopware55/Converter/MediaConverterTest.php @@ -48,10 +48,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new MediaDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/MediaFolderConverterTest.php b/tests/Profile/Shopware55/Converter/MediaFolderConverterTest.php index 800b26309..2c8c294e4 100644 --- a/tests/Profile/Shopware55/Converter/MediaFolderConverterTest.php +++ b/tests/Profile/Shopware55/Converter/MediaFolderConverterTest.php @@ -47,10 +47,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new MediaFolderDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/NewsletterRecipientConverterTest.php b/tests/Profile/Shopware55/Converter/NewsletterRecipientConverterTest.php index fcd63dd9f..f45d56585 100644 --- a/tests/Profile/Shopware55/Converter/NewsletterRecipientConverterTest.php +++ b/tests/Profile/Shopware55/Converter/NewsletterRecipientConverterTest.php @@ -53,10 +53,11 @@ protected function setUp(): void $connection->setGatewayName(ShopwareLocalGateway::GATEWAY_NAME); $this->context = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new NewsletterRecipientDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/NumberRangeConverterTest.php b/tests/Profile/Shopware55/Converter/NumberRangeConverterTest.php index 66c65ffe1..1747507da 100644 --- a/tests/Profile/Shopware55/Converter/NumberRangeConverterTest.php +++ b/tests/Profile/Shopware55/Converter/NumberRangeConverterTest.php @@ -50,10 +50,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new NumberRangeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/OrderAttributeConverterTest.php b/tests/Profile/Shopware55/Converter/OrderAttributeConverterTest.php index c93506eee..c3e4c10f8 100644 --- a/tests/Profile/Shopware55/Converter/OrderAttributeConverterTest.php +++ b/tests/Profile/Shopware55/Converter/OrderAttributeConverterTest.php @@ -39,10 +39,11 @@ protected function setUp(): void $connection->setName('ConnectionName'); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new OrderAttributeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/OrderConverterTest.php b/tests/Profile/Shopware55/Converter/OrderConverterTest.php index 1256004e9..c5eb150d9 100644 --- a/tests/Profile/Shopware55/Converter/OrderConverterTest.php +++ b/tests/Profile/Shopware55/Converter/OrderConverterTest.php @@ -110,19 +110,21 @@ protected function setUp(): void $connection->setName('shopware'); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new OrderDataSet(), + $runId, 0, 250 ); $this->customerMigrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new CustomerDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/ProductAttributeConverterTest.php b/tests/Profile/Shopware55/Converter/ProductAttributeConverterTest.php index 9451d2c9e..da97a983c 100644 --- a/tests/Profile/Shopware55/Converter/ProductAttributeConverterTest.php +++ b/tests/Profile/Shopware55/Converter/ProductAttributeConverterTest.php @@ -39,10 +39,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new ProductAttributeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/ProductConverterTest.php b/tests/Profile/Shopware55/Converter/ProductConverterTest.php index f945ad0c2..6d28d0be1 100644 --- a/tests/Profile/Shopware55/Converter/ProductConverterTest.php +++ b/tests/Profile/Shopware55/Converter/ProductConverterTest.php @@ -69,10 +69,11 @@ protected function setUp(): void $connection->setName('shopware'); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new ProductDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/ProductOptionRelationConverterTest.php b/tests/Profile/Shopware55/Converter/ProductOptionRelationConverterTest.php index 5b5edc3ba..4f3635330 100644 --- a/tests/Profile/Shopware55/Converter/ProductOptionRelationConverterTest.php +++ b/tests/Profile/Shopware55/Converter/ProductOptionRelationConverterTest.php @@ -53,10 +53,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new ProductOptionRelationDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/ProductPriceAttributeConverterTest.php b/tests/Profile/Shopware55/Converter/ProductPriceAttributeConverterTest.php index 1d6c8fda0..213e0d4cf 100644 --- a/tests/Profile/Shopware55/Converter/ProductPriceAttributeConverterTest.php +++ b/tests/Profile/Shopware55/Converter/ProductPriceAttributeConverterTest.php @@ -37,10 +37,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new ProductPriceAttributeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/ProductPropertyRelationConverterTest.php b/tests/Profile/Shopware55/Converter/ProductPropertyRelationConverterTest.php index aaac60b9a..5f3fae718 100644 --- a/tests/Profile/Shopware55/Converter/ProductPropertyRelationConverterTest.php +++ b/tests/Profile/Shopware55/Converter/ProductPropertyRelationConverterTest.php @@ -51,10 +51,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new ProductPropertyRelationDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/ProductReviewConverterTest.php b/tests/Profile/Shopware55/Converter/ProductReviewConverterTest.php index 8b423f326..594a89dab 100644 --- a/tests/Profile/Shopware55/Converter/ProductReviewConverterTest.php +++ b/tests/Profile/Shopware55/Converter/ProductReviewConverterTest.php @@ -65,10 +65,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new ProductReviewDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/PromotionConverterTest.php b/tests/Profile/Shopware55/Converter/PromotionConverterTest.php index c1e67cf0d..29c62c30d 100644 --- a/tests/Profile/Shopware55/Converter/PromotionConverterTest.php +++ b/tests/Profile/Shopware55/Converter/PromotionConverterTest.php @@ -67,10 +67,11 @@ protected function setUp(): void $connectionId = $connection->getId(); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new PromotionDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/PropertyGroupOptionConverterTest.php b/tests/Profile/Shopware55/Converter/PropertyGroupOptionConverterTest.php index 7c7896b3e..f5a27bc54 100644 --- a/tests/Profile/Shopware55/Converter/PropertyGroupOptionConverterTest.php +++ b/tests/Profile/Shopware55/Converter/PropertyGroupOptionConverterTest.php @@ -96,10 +96,11 @@ protected function setUp(): void $this->connection->setName('shopware'); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $runId, + new Shopware55Profile(), + null, new PropertyGroupOptionDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/SalesChannelConverterTest.php b/tests/Profile/Shopware55/Converter/SalesChannelConverterTest.php index 311ee05f7..cf710474f 100644 --- a/tests/Profile/Shopware55/Converter/SalesChannelConverterTest.php +++ b/tests/Profile/Shopware55/Converter/SalesChannelConverterTest.php @@ -69,10 +69,11 @@ protected function setUp(): void $connection->setProfileName(Shopware55Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $connection, - $runId, + new Shopware55Profile(), + null, new SalesChannelDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/ShippingMethodConverterTest.php b/tests/Profile/Shopware55/Converter/ShippingMethodConverterTest.php index 6cf42e995..fe93cdfdd 100644 --- a/tests/Profile/Shopware55/Converter/ShippingMethodConverterTest.php +++ b/tests/Profile/Shopware55/Converter/ShippingMethodConverterTest.php @@ -77,10 +77,11 @@ protected function setUp(): void $this->context = Context::createDefaultContext(); $this->migrationContext = new MigrationContext( - new Shopware55Profile(), $this->connection, - $runId, + new Shopware55Profile(), + null, new ShippingMethodDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware55/Converter/TranslationConverterTest.php b/tests/Profile/Shopware55/Converter/TranslationConverterTest.php index eb5f20c32..1d452d25b 100644 --- a/tests/Profile/Shopware55/Converter/TranslationConverterTest.php +++ b/tests/Profile/Shopware55/Converter/TranslationConverterTest.php @@ -95,28 +95,31 @@ protected function setUp(): void $profile = new Shopware55Profile(); $this->migrationContext = new MigrationContext( - $profile, $connection, - $runId, + $profile, + null, new TranslationDataSet(), + $runId, 0, 250 ); $this->productMigrationContext = new MigrationContext( - $profile, $connection, - $runId, + $profile, + null, new ProductDataSet(), + $runId, 0, 250 ); $this->categoryMigrationContext = new MigrationContext( - $profile, $connection, - $runId, + $profile, + null, new CategoryDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware57/Converter/ProductAttributeConverterTest.php b/tests/Profile/Shopware57/Converter/ProductAttributeConverterTest.php index ee0fe2510..bf56b26d4 100644 --- a/tests/Profile/Shopware57/Converter/ProductAttributeConverterTest.php +++ b/tests/Profile/Shopware57/Converter/ProductAttributeConverterTest.php @@ -39,10 +39,11 @@ protected function setUp(): void $connection->setProfileName(Shopware57Profile::PROFILE_NAME); $this->migrationContext = new MigrationContext( - new Shopware57Profile(), $connection, - $runId, + new Shopware57Profile(), + null, new ProductAttributeDataSet(), + $runId, 0, 250 ); diff --git a/tests/Profile/Shopware6/Converter/LanguageConverterConvertDataTest.php b/tests/Profile/Shopware6/Converter/LanguageConverterConvertDataTest.php index a62cb2431..559e23a42 100644 --- a/tests/Profile/Shopware6/Converter/LanguageConverterConvertDataTest.php +++ b/tests/Profile/Shopware6/Converter/LanguageConverterConvertDataTest.php @@ -159,10 +159,11 @@ private function createMigrationContext(): MigrationContext $migrationConnectionEntity->setId(Uuid::randomHex()); return new MigrationContext( - new Shopware6MajorProfile('6.6.0.0'), $migrationConnectionEntity, - Uuid::randomHex(), + new Shopware6MajorProfile('6.6.0.0'), + null, new LanguageDataSet(), + Uuid::randomHex(), 0, 10 ); diff --git a/tests/Profile/Shopware6/Converter/SeoUrlConverterConvertDataTest.php b/tests/Profile/Shopware6/Converter/SeoUrlConverterConvertDataTest.php index b9fe08772..eca23847e 100644 --- a/tests/Profile/Shopware6/Converter/SeoUrlConverterConvertDataTest.php +++ b/tests/Profile/Shopware6/Converter/SeoUrlConverterConvertDataTest.php @@ -49,10 +49,11 @@ private function createMigrationContext(): MigrationContext $migrationConnectionEntity->setId(Uuid::randomHex()); return new MigrationContext( - new Shopware6MajorProfile('6.6.0.0'), $migrationConnectionEntity, - Uuid::randomHex(), + new Shopware6MajorProfile('6.6.0.0'), + null, new SeoUrlDataSet(), + Uuid::randomHex(), 0, 10 ); diff --git a/tests/Profile/Shopware6/Converter/ShopwareConverterTest.php b/tests/Profile/Shopware6/Converter/ShopwareConverterTest.php index 5a1a36a2c..fe76c80b5 100644 --- a/tests/Profile/Shopware6/Converter/ShopwareConverterTest.php +++ b/tests/Profile/Shopware6/Converter/ShopwareConverterTest.php @@ -52,10 +52,11 @@ protected function setUp(): void $connection->setId(Uuid::randomHex()); $connection->setProfileName($this->getProfileName()); $this->migrationContext = new MigrationContext( - $this->createProfile(), $connection, - $runId, + $this->createProfile(), + null, $this->createDataSet(), + $runId, 0, 250 ); @@ -166,13 +167,8 @@ protected function getProfileName(): string protected function loadMapping(array $mappingArray): void { - $connection = $this->migrationContext->getConnection(); - - if ($connection === null) { - return; - } + $connectionId = $this->migrationContext->getConnection()->getId(); - $connectionId = $connection->getId(); foreach ($mappingArray as $mapping) { $mappingConnection = null; if (isset($mapping['connectionId'])) { diff --git a/tests/Profile/Shopware6/Gateway/Api/Reader/EnvironmentReaderTest.php b/tests/Profile/Shopware6/Gateway/Api/Reader/EnvironmentReaderTest.php index c3dd5e2f8..0fba0a17e 100644 --- a/tests/Profile/Shopware6/Gateway/Api/Reader/EnvironmentReaderTest.php +++ b/tests/Profile/Shopware6/Gateway/Api/Reader/EnvironmentReaderTest.php @@ -19,6 +19,7 @@ use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Log\Package; use SwagMigrationAssistant\Exception\MigrationException; +use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionEntity; use SwagMigrationAssistant\Migration\Gateway\HttpSimpleClient; use SwagMigrationAssistant\Migration\MigrationContext; use SwagMigrationAssistant\Migration\RequestStatusStruct; @@ -41,7 +42,8 @@ public function testEmptyClientReturnsRequestStatus(): void $environmentReader = new EnvironmentReader($connectionFactory); $migrationContext = new MigrationContext( - new Shopware6MajorProfile('6.6.0') + new SwagMigrationConnectionEntity(), + new Shopware6MajorProfile('6.6.0'), ); $response = $environmentReader->read($migrationContext); @@ -80,7 +82,8 @@ public function testResponseExceptions( $client = new HttpSimpleClient($options); $migrationContext = new MigrationContext( - new Shopware6MajorProfile('6.6.0') + new SwagMigrationConnectionEntity(), + new Shopware6MajorProfile('6.6.0'), ); $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); @@ -219,7 +222,8 @@ public function testGetsEnvironmentInformation(): void $client = new HttpSimpleClient($options); $migrationContext = new MigrationContext( - new Shopware6MajorProfile('6.6.0') + new SwagMigrationConnectionEntity(), + new Shopware6MajorProfile('6.6.0'), ); $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); diff --git a/tests/Profile/Shopware6/Gateway/Api/Shopware6ApiGatewayTest.php b/tests/Profile/Shopware6/Gateway/Api/Shopware6ApiGatewayTest.php index 5c892c32b..4cf0f9cda 100644 --- a/tests/Profile/Shopware6/Gateway/Api/Shopware6ApiGatewayTest.php +++ b/tests/Profile/Shopware6/Gateway/Api/Shopware6ApiGatewayTest.php @@ -354,10 +354,11 @@ protected function createMigrationContext(string $selfShopwareVersion): Migratio ]); return new MigrationContext( - $profile, $connection, - Uuid::randomHex(), + $profile, null, + null, + Uuid::randomHex(), 0, 100 ); diff --git a/tests/Profile/Shopware6/Gateway/Connection/ConnectionFactoryTests.php b/tests/Profile/Shopware6/Gateway/Connection/ConnectionFactoryTests.php index e98825dc1..56b7fbd29 100644 --- a/tests/Profile/Shopware6/Gateway/Connection/ConnectionFactoryTests.php +++ b/tests/Profile/Shopware6/Gateway/Connection/ConnectionFactoryTests.php @@ -29,8 +29,8 @@ public function testCreateApiClient(?array $credentials, bool $expectedToBeNull) } $migrationContext = new MigrationContext( - new Shopware6MajorProfile('6.5.6.1'), $connection, + new Shopware6MajorProfile('6.5.6.1'), ); /** @var StaticEntityRepository $connectionRepository */ diff --git a/tests/Profile/Shopware6/Premapping/UserReaderTest.php b/tests/Profile/Shopware6/Premapping/UserReaderTest.php index c2868ac3c..a53ba569a 100644 --- a/tests/Profile/Shopware6/Premapping/UserReaderTest.php +++ b/tests/Profile/Shopware6/Premapping/UserReaderTest.php @@ -103,8 +103,8 @@ protected function setUp(): void $gatewayRegistryMock->method('getGateway')->willReturn($gatewayMock); $this->migrationContext = new MigrationContext( + $connection, new Shopware6MajorProfile('6.6'), - $connection ); $this->reader = new UserReader($mock, $gatewayRegistryMock);