$languageRepository */
- $languageRepository = $this->getContainer()->get('language.repository');
+ $languageRepository = static::getContainer()->get('language.repository');
$gateway = new ShopwareLocalGateway(
$readerRegistry,
diff --git a/tests/Profile/Shopware/Gateway/ShopwareApiGatewayTest.php b/tests/Profile/Shopware/Gateway/ShopwareApiGatewayTest.php
index c4da62be4..49bc0cdb3 100644
--- a/tests/Profile/Shopware/Gateway/ShopwareApiGatewayTest.php
+++ b/tests/Profile/Shopware/Gateway/ShopwareApiGatewayTest.php
@@ -54,8 +54,8 @@ public function testReadFailed(): void
$environmentReader,
$tableReader,
$tableCountReader,
- $this->getContainer()->get('currency.repository'),
- $this->getContainer()->get('language.repository')
+ static::getContainer()->get('currency.repository'),
+ static::getContainer()->get('language.repository')
);
$migrationContext->setGateway($gateway);
@@ -94,8 +94,8 @@ public function testReadEnvironmentInformationFailed(): void
$environmentReader,
$tableReader,
$tableCountReader,
- $this->getContainer()->get('currency.repository'),
- $this->getContainer()->get('language.repository')
+ static::getContainer()->get('currency.repository'),
+ static::getContainer()->get('language.repository')
);
$response = $gateway->readEnvironmentInformation($migrationContext, Context::createDefaultContext());
@@ -126,8 +126,8 @@ public function testReadEnvironmentInformation(): void
$environmentReader,
$tableReader,
$tableCountReader,
- $this->getContainer()->get('currency.repository'),
- $this->getContainer()->get('language.repository')
+ static::getContainer()->get('currency.repository'),
+ static::getContainer()->get('language.repository')
);
$response = $gateway->readEnvironmentInformation($migrationContext, Context::createDefaultContext());
@@ -158,8 +158,8 @@ public function testReadEnvironmentInformationWithoutSourceDefaultLanguage(): vo
$environmentReader,
$tableReader,
$tableCountReader,
- $this->getContainer()->get('currency.repository'),
- $this->getContainer()->get('language.repository')
+ static::getContainer()->get('currency.repository'),
+ static::getContainer()->get('language.repository')
);
/** @var EnvironmentInformation $response */
$response = $gateway->readEnvironmentInformation($migrationContext, Context::createDefaultContext());
diff --git a/tests/Profile/Shopware54/Converter/OrderDocumentConverterTest.php b/tests/Profile/Shopware54/Converter/OrderDocumentConverterTest.php
index 3bf9bdd14..c790ac098 100644
--- a/tests/Profile/Shopware54/Converter/OrderDocumentConverterTest.php
+++ b/tests/Profile/Shopware54/Converter/OrderDocumentConverterTest.php
@@ -14,6 +14,7 @@
use Shopware\Core\Framework\Test\TestCaseBase\KernelTestBehaviour;
use Shopware\Core\Framework\Uuid\Uuid;
use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionEntity;
+use SwagMigrationAssistant\Migration\Converter\ConvertStruct;
use SwagMigrationAssistant\Migration\DataSelection\DefaultEntities;
use SwagMigrationAssistant\Migration\Logging\LoggingServiceInterface;
use SwagMigrationAssistant\Migration\Mapping\Lookup\DocumentTypeLookup;
@@ -91,37 +92,6 @@ public function testSupports(): void
static::assertTrue($supportsDefinition);
}
- public function testConvertWithUnknownOrderId(): void
- {
- $orderDocumentData = require __DIR__ . '/../../../_fixtures/order_document_data.php';
- $context = Context::createDefaultContext();
-
- $convertResult = $this->orderDocumentConverter->convert(
- $orderDocumentData[1],
- $context,
- $this->migrationContext
- );
- static::assertEmpty($convertResult->getConverted());
- $logs = $this->loggingService->getLoggingArray();
- static::assertSame('SWAG_MIGRATION__SHOPWARE_ASSOCIATION_REQUIRED_MISSING', $logs[0]['code']);
- }
-
- public function testConvertWithoutDocumentType(): void
- {
- $orderDocumentData = require __DIR__ . '/../../../_fixtures/order_document_data.php';
- $context = Context::createDefaultContext();
- unset($orderDocumentData[0]['documenttype']);
-
- $convertResult = $this->orderDocumentConverter->convert(
- $orderDocumentData[0],
- $context,
- $this->migrationContext
- );
- static::assertEmpty($convertResult->getConverted());
- $logs = $this->loggingService->getLoggingArray();
- static::assertSame('SWAG_MIGRATION_EMPTY_NECESSARY_FIELD', $logs[0]['code']);
- }
-
public function testConvert(): void
{
$orderDocumentData = require __DIR__ . '/../../../_fixtures/order_document_data.php';
@@ -182,6 +152,7 @@ public function testConvertShouldLogUnknownType(): void
$this->migrationContext
);
+ static::assertInstanceOf(ConvertStruct::class, $convertResult);
$converted = $convertResult->getConverted();
static::assertIsArray($converted);
@@ -218,6 +189,7 @@ public function testConvertShouldMapDocumentTypes(array $document, string $expec
$this->migrationContext
);
+ static::assertInstanceOf(ConvertStruct::class, $convertResult);
$converted = $convertResult->getConverted();
static::assertIsArray($converted);
diff --git a/tests/Profile/Shopware54/Converter/ProductConverterTest.php b/tests/Profile/Shopware54/Converter/ProductConverterTest.php
index c35586835..e93400732 100644
--- a/tests/Profile/Shopware54/Converter/ProductConverterTest.php
+++ b/tests/Profile/Shopware54/Converter/ProductConverterTest.php
@@ -54,10 +54,10 @@ public function testConvertShouldConvertSeoMainCategories(): void
$mappingServiceMock,
$loggerMock,
$mediaFileServiceMock,
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class),
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class),
);
$data = require __DIR__ . '/_fixtures/product_with_seo_main_category.php';
diff --git a/tests/Profile/Shopware55/Converter/CategoryConverterTest.php b/tests/Profile/Shopware55/Converter/CategoryConverterTest.php
index abdc073d2..2cf8560f4 100644
--- a/tests/Profile/Shopware55/Converter/CategoryConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/CategoryConverterTest.php
@@ -50,9 +50,9 @@ protected function setUp(): void
$mappingService,
$this->loggingService,
$mediaFileService,
- $this->getContainer()->get(LowestRootCategoryLookup::class),
- $this->getContainer()->get(DefaultCmsPageLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(LowestRootCategoryLookup::class),
+ static::getContainer()->get(DefaultCmsPageLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
);
$runId = Uuid::randomHex();
@@ -99,8 +99,8 @@ public function testConvert(): void
new DummyMappingService(),
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(LowestRootCategoryLookup::class),
- $this->getContainer()->get(DefaultCmsPageLookup::class),
+ static::getContainer()->get(LowestRootCategoryLookup::class),
+ static::getContainer()->get(DefaultCmsPageLookup::class),
$languageLookup
);
@@ -132,9 +132,8 @@ public function testConvertWithParent(): void
new DummyMappingService(),
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(LowestRootCategoryLookup::class),
- $this->getContainer()->get(DefaultCmsPageLookup::class),
- // $this->getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(LowestRootCategoryLookup::class),
+ static::getContainer()->get(DefaultCmsPageLookup::class),
$languageLookup
);
@@ -175,10 +174,39 @@ public function testConvertWithoutLocale(): void
$context = Context::createDefaultContext();
$convertResult = $this->categoryConverter->convert($categoryData, $context, $this->migrationContext);
- static::assertNull($convertResult->getConverted());
- $logs = $this->loggingService->getLoggingArray();
- static::assertCount(1, $logs);
+ $converted = $convertResult->getConverted();
+ static::assertNotNull($converted);
+
+ $expected = [
+ 'description' => 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
',
+ 'level' => 0,
+ 'active' => true,
+ 'visible' => true,
+ 'name' => 'Lebensmittel',
+ ];
+
+ static::assertArrayHasKey('id', $converted);
+ static::assertTrue(Uuid::isValid($converted['id']));
+
+ static::assertArrayHasKey('afterCategoryId', $converted);
+ static::assertTrue(Uuid::isValid($converted['afterCategoryId']));
+
+ static::assertArrayHasKey('cmsPageId', $converted);
+ static::assertTrue(Uuid::isValid($converted['cmsPageId']));
+
+ foreach ($expected as $key => $value) {
+ static::assertSame($value, $converted[$key]);
+ }
+
+ static::assertArrayHasKey('media', $converted);
+ $media = $converted['media'];
+ static::assertArrayHasKey('id', $media);
+ static::assertArrayHasKey('title', $media);
+ static::assertArrayHasKey('alt', $media);
+ static::assertTrue(Uuid::isValid($media['id']));
+ static::assertSame('brot', $media['title']);
+ static::assertSame('Nices Brot', $media['alt']);
}
public function testConvertWithExternalLink(): void
diff --git a/tests/Profile/Shopware55/Converter/CrossSellingConverterTest.php b/tests/Profile/Shopware55/Converter/CrossSellingConverterTest.php
index 1fe87ba8a..3cd3541d8 100644
--- a/tests/Profile/Shopware55/Converter/CrossSellingConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/CrossSellingConverterTest.php
@@ -144,34 +144,6 @@ public function testConvertMultipleTime(): void
static::assertSame($converted1['assignedProducts'][0]['productId'], $converted2['assignedProducts']['0']['productId']);
}
- public function testConvertWithoutMapping(): void
- {
- $data = require __DIR__ . '/../../../_fixtures/cross_selling_data.php';
- $product = $data[0];
- $product['articleID'] = '99';
-
- $context = Context::createDefaultContext();
- $convertResult = $this->crossSellingConverter->convert($product, $context, $this->migrationContext);
-
- static::assertNotNull($convertResult->getUnmapped());
- static::assertNull($convertResult->getConverted());
-
- $logs = $this->loggingService->getLoggingArray();
- static::assertCount(1, $logs);
- static::assertSame('SWAG_MIGRATION__SHOPWARE_ASSOCIATION_REQUIRED_MISSING', $logs[0]['code']);
-
- $this->loggingService->resetLogging();
- $data[0]['relatedarticle'] = '80';
- $convertResult = $this->crossSellingConverter->convert($data[0], $context, $this->migrationContext);
-
- static::assertNotNull($convertResult->getUnmapped());
- static::assertNull($convertResult->getConverted());
-
- $logs = $this->loggingService->getLoggingArray();
- static::assertCount(1, $logs);
- static::assertSame('SWAG_MIGRATION__SHOPWARE_ASSOCIATION_REQUIRED_MISSING', $logs[0]['code']);
- }
-
public function testConvertCreatesAdditionalMappingForTypeAndArticleId(): void
{
$crossSellingData = require __DIR__ . '/../../../_fixtures/cross_selling_data.php';
@@ -256,6 +228,8 @@ private function checkProduct(int $fromIndex, int $toIndex, ConvertStruct $conve
static::assertNull($convertStruct->getUnmapped());
static::assertNotNull($convertStruct->getMappingUuid());
- static::assertSame($this->compareProduct, $converted);
+ foreach ($this->compareProduct as $key => $value) {
+ static::assertSame($value, $converted[$key]);
+ }
}
}
diff --git a/tests/Profile/Shopware55/Converter/CurrencyConverterTest.php b/tests/Profile/Shopware55/Converter/CurrencyConverterTest.php
index 66e4dc60f..56e76185b 100644
--- a/tests/Profile/Shopware55/Converter/CurrencyConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/CurrencyConverterTest.php
@@ -98,10 +98,10 @@ public function testConvert(): void
$currencyData = require __DIR__ . '/../../../_fixtures/currency_data.php';
$convertResult = $this->converter->convert($currencyData[0], $this->context, $this->migrationContext);
$this->converter->writeMapping($this->context);
- $converted = $convertResult->getConverted();
+ $converted = $convertResult?->getConverted();
- static::assertNull($convertResult->getUnmapped());
- static::assertNotNull($convertResult->getMappingUuid());
+ static::assertNull($convertResult?->getUnmapped());
+ static::assertNotNull($convertResult?->getMappingUuid());
static::assertNotNull($converted);
static::assertArrayHasKey('id', $converted);
static::assertArrayHasKey('translations', $converted);
@@ -141,10 +141,27 @@ public function testConvertWhichExists(): void
$convertResult = $this->converter->convert($currencyData[0], $this->context, $this->migrationContext);
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
-
- $logs = $this->loggingService->getLoggingArray();
- static::assertEmpty($logs);
+ $expected = [
+ 'isDefault' => false,
+ 'shortName' => 'COC',
+ 'isoCode' => 'COC',
+ 'name' => 'Kekse',
+ 'factor' => 100.0,
+ 'position' => 0,
+ 'symbol' => 'COOKIES',
+ 'placedInFront' => false,
+ 'itemRounding' => [
+ 'decimals' => 2,
+ 'interval' => 0.01,
+ 'roundForNet' => true,
+ ],
+ 'totalRounding' => [
+ 'decimals' => 2,
+ 'interval' => 0.01,
+ 'roundForNet' => true,
+ ],
+ ];
+
+ static::assertNull($convertResult);
}
}
diff --git a/tests/Profile/Shopware55/Converter/CustomerConverterTest.php b/tests/Profile/Shopware55/Converter/CustomerConverterTest.php
index 76105f918..3ccabe247 100644
--- a/tests/Profile/Shopware55/Converter/CustomerConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/CustomerConverterTest.php
@@ -7,6 +7,7 @@
namespace SwagMigrationAssistant\Test\Profile\Shopware55\Converter;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Shopware\Core\Checkout\Customer\CustomerEntity;
use Shopware\Core\Framework\Context;
@@ -138,6 +139,40 @@ public function testConvert(): void
static::assertCount(0, $this->loggingService->getLoggingArray());
}
+ #[DataProvider('requiredProperties')]
+ public function testConvertWithoutRequiredProperties(string $property, ?string $value): void
+ {
+ $customerData = require __DIR__ . '/../../../_fixtures/customer_data.php';
+ $customerData = $customerData[0];
+ $customerData[$property] = $value;
+
+ $context = Context::createDefaultContext();
+ $convertResult = $this->customerConverter->convert(
+ $customerData,
+ $context,
+ $this->migrationContext
+ );
+ static::assertNotNull($convertResult->getConverted());
+ }
+
+ /**
+ * @return array>
+ */
+ public static function requiredProperties(): array
+ {
+ return [
+ 'email is null' => ['email', null],
+ 'email is empty' => ['email', ''],
+ 'firstname is null' => ['firstname', null],
+ 'firstname is empty' => ['firstname', ''],
+ 'lastname is null' => ['lastname', null],
+ 'lastname is empty' => ['lastname', ''],
+ 'defaultpayment is null' => ['defaultpayment', null],
+ 'customerGroupId is empty' => ['customerGroupId', ''],
+ 'customerGroupId is null' => ['customerGroupId', null],
+ ];
+ }
+
public function testConvertGuestAccount(): void
{
$customerData = require __DIR__ . '/../../../_fixtures/customer_data.php';
@@ -161,6 +196,177 @@ public function testConvertGuestAccount(): void
static::assertCount(0, $this->loggingService->getLoggingArray());
}
+ public function testConvertCustomerWithoutNumber(): void
+ {
+ $customerData = require __DIR__ . '/../../../_fixtures/customer_data.php';
+ $customerData = $customerData[0];
+ $customerData['customernumber'] = null;
+
+ $context = Context::createDefaultContext();
+ $convertResult = $this->customerConverter->convert(
+ $customerData,
+ $context,
+ $this->migrationContext
+ );
+
+ $converted = $convertResult->getConverted();
+ static::assertNotNull($converted);
+
+ static::assertNull($convertResult->getUnmapped());
+ static::assertArrayHasKey('id', $converted);
+ static::assertArrayHasKey('addresses', $converted);
+ static::assertSame(TestDefaults::SALES_CHANNEL, $converted['salesChannelId']);
+ static::assertSame('Mustermann', $converted['lastName']);
+ static::assertSame('number-1', $converted['customerNumber']);
+ static::assertCount(0, $this->loggingService->getLoggingArray());
+ }
+
+ public function testConvertCustomerWithoutPaymentAndWithDefaultPayment(): void
+ {
+ $customerData = require __DIR__ . '/../../../_fixtures/customer_data.php';
+ $customerData = $customerData[0];
+ unset($customerData['defaultpayment']);
+
+ $context = Context::createDefaultContext();
+ $mapping = $this->mappingService->getOrCreateMapping($this->connectionId, PaymentMethodReader::getMappingName(), PaymentMethodReader::SOURCE_ID, $context, null, [], Uuid::randomHex());
+ $convertResult = $this->customerConverter->convert(
+ $customerData,
+ $context,
+ $this->migrationContext
+ );
+
+ $converted = $convertResult->getConverted();
+ $logs = $this->loggingService->getLoggingArray();
+
+ static::assertNull($convertResult->getUnmapped());
+ static::assertNotNull($converted);
+ static::assertCount(0, $logs);
+ static::assertArrayHasKey('id', $converted);
+ static::assertArrayHasKey('addresses', $converted);
+ static::assertSame(TestDefaults::SALES_CHANNEL, $converted['salesChannelId']);
+ static::assertSame('Mustermann', $converted['lastName']);
+ static::assertSame($mapping['entityId'], $converted['defaultPaymentMethodId']);
+ static::assertCount(0, $this->loggingService->getLoggingArray());
+ }
+
+ /**
+ * @return array>
+ */
+ public static function requiredAddressProperties(): array
+ {
+ return [
+ 'firstname is null' => ['firstname', null],
+ 'firstname is empty' => ['firstname', ''],
+ 'lastname is null' => ['lastname', null],
+ 'lastname is empty' => ['lastname', ''],
+ 'zipcode is null' => ['zipcode', null],
+ 'zipcode is empty' => ['zipcode', ''],
+ 'city is null' => ['city', null],
+ 'city is empty' => ['city', ''],
+ 'street is null' => ['street', null],
+ 'street is empty' => ['street', ''],
+ ];
+ }
+
+ #[DataProvider('requiredAddressProperties')]
+ public function testConvertWithoutRequiredAddressPropertiesForBillingDefault(string $property, ?string $value): void
+ {
+ $customerData = require __DIR__ . '/../../../_fixtures/customer_data.php';
+ $customerData = $customerData[0];
+ $customerData['addresses'][0][$property] = $value;
+
+ $context = Context::createDefaultContext();
+ $convertResult = $this->customerConverter->convert(
+ $customerData,
+ $context,
+ $this->migrationContext
+ );
+
+ $converted = $convertResult->getConverted();
+ static::assertNotNull($converted);
+
+ static::assertNull($convertResult->getUnmapped());
+ static::assertArrayHasKey('id', $converted);
+ static::assertArrayHasKey('addresses', $converted);
+
+ static::assertSame('Mustermannstraße 92', $converted['addresses'][0]['street']);
+ static::assertSame($converted['addresses'][0]['id'], $converted['defaultBillingAddressId']);
+ static::assertSame($converted['addresses'][0]['id'], $converted['defaultShippingAddressId']);
+
+ $logs = $this->loggingService->getLoggingArray();
+ static::assertCount(2, $logs);
+
+ static::assertSame($logs[0]['code'], 'SWAG_MIGRATION_EMPTY_NECESSARY_FIELD');
+ static::assertSame($logs[1]['code'], 'SWAG_MIGRATION_ENTITY_FIELD_REASSIGNED');
+ }
+
+ #[DataProvider('requiredAddressProperties')]
+ public function testConvertWithoutRequiredAddressPropertiesForShippingDefault(string $property, ?string $value): void
+ {
+ $customerData = require __DIR__ . '/../../../_fixtures/customer_data.php';
+ $customerData = $customerData[0];
+ $customerData['addresses'][1][$property] = $value;
+
+ $context = Context::createDefaultContext();
+ $convertResult = $this->customerConverter->convert(
+ $customerData,
+ $context,
+ $this->migrationContext
+ );
+
+ $converted = $convertResult->getConverted();
+ static::assertNotNull($converted);
+
+ static::assertNull($convertResult->getUnmapped());
+ static::assertArrayHasKey('id', $converted);
+ static::assertArrayHasKey('addresses', $converted);
+
+ static::assertSame('Musterstr. 55', $converted['addresses'][0]['street']);
+ static::assertSame($converted['addresses'][0]['id'], $converted['defaultBillingAddressId']);
+ static::assertSame($converted['addresses'][0]['id'], $converted['defaultShippingAddressId']);
+
+ $logs = $this->loggingService->getLoggingArray();
+ static::assertCount(2, $logs);
+
+ static::assertSame($logs[0]['code'], 'SWAG_MIGRATION_EMPTY_NECESSARY_FIELD');
+ static::assertSame($logs[1]['code'], 'SWAG_MIGRATION_ENTITY_FIELD_REASSIGNED');
+ }
+
+ #[DataProvider('requiredAddressProperties')]
+ public function testConvertWithoutRequiredAddressPropertiesForDefaultBillingAndShipping(string $property, ?string $value): void
+ {
+ $customerData = require __DIR__ . '/../../../_fixtures/customer_data.php';
+ $customerData = $customerData[0];
+ $customerData['addresses'][0][$property] = $value;
+ $customerData['addresses'][1][$property] = $value;
+
+ $context = Context::createDefaultContext();
+ $convertResult = $this->customerConverter->convert(
+ $customerData,
+ $context,
+ $this->migrationContext
+ );
+
+ $converted = $convertResult->getConverted();
+ static::assertNotNull($converted);
+
+ static::assertNull($convertResult->getUnmapped());
+ static::assertArrayHasKey('id', $converted);
+ static::assertArrayHasKey('addresses', $converted);
+
+ static::assertSame('Musterstraße 3', $converted['addresses'][0]['street']);
+ static::assertSame($converted['addresses'][0]['id'], $converted['defaultBillingAddressId']);
+ static::assertSame($converted['addresses'][0]['id'], $converted['defaultShippingAddressId']);
+
+ $logs = $this->loggingService->getLoggingArray();
+ static::assertCount(4, $logs);
+
+ static::assertSame($logs[0]['code'], 'SWAG_MIGRATION_EMPTY_NECESSARY_FIELD');
+ static::assertSame($logs[1]['code'], 'SWAG_MIGRATION_EMPTY_NECESSARY_FIELD');
+ static::assertSame($logs[2]['code'], 'SWAG_MIGRATION_ENTITY_FIELD_REASSIGNED');
+ static::assertSame($logs[2]['code'], 'SWAG_MIGRATION_ENTITY_FIELD_REASSIGNED');
+ }
+
public function testGetCustomerWithShopScope(): void
{
$customerData = require __DIR__ . '/../../../_fixtures/customer_data.php';
@@ -199,7 +405,7 @@ public function testConvertCountryStateWithMapping(): void
$criteria = new Criteria();
$criteria->addFilter(new EqualsFilter('shortCode', 'DE-NW'));
- $expectedStateId = $this->getContainer()->get('country_state.repository')->searchIds($criteria, $context)->firstId();
+ $expectedStateId = static::getContainer()->get('country_state.repository')->searchIds($criteria, $context)->firstId();
static::assertNotNull($converted);
static::assertArrayHasKey('id', $converted);
@@ -226,7 +432,7 @@ public function testConvertExistingCountryStateWithoutMapping(): void
$criteria = new Criteria();
$criteria->addFilter(new EqualsFilter('shortCode', 'DE-NW'));
- $expectedStateId = $this->getContainer()->get('country_state.repository')->searchIds($criteria, $context)->firstId();
+ $expectedStateId = static::getContainer()->get('country_state.repository')->searchIds($criteria, $context)->firstId();
static::assertNotNull($converted);
static::assertArrayHasKey('id', $converted);
diff --git a/tests/Profile/Shopware55/Converter/CustomerWishlistConverterTest.php b/tests/Profile/Shopware55/Converter/CustomerWishlistConverterTest.php
index a8b080157..a566e6a38 100644
--- a/tests/Profile/Shopware55/Converter/CustomerWishlistConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/CustomerWishlistConverterTest.php
@@ -112,43 +112,4 @@ public function testConvert(): void
$wishlistProduct = $wishlistProducts[0];
static::assertArrayHasKey('id', $wishlistProduct);
}
-
- public function testConvertWithoutCustomer(): void
- {
- $data = require __DIR__ . '/../../../_fixtures/customer_wishlist.php';
- $data[0]['userID'] = '99';
-
- $convertResult = $this->converter->convert($data[0], $this->context, $this->migrationContext);
- $this->converter->writeMapping($this->context);
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertNull($convertResult->getMappingUuid());
- }
-
- public function testConvertWithoutProduct(): void
- {
- $data = require __DIR__ . '/../../../_fixtures/customer_wishlist.php';
- $data[0]['ordernumber'] = '99';
-
- $convertResult = $this->converter->convert($data[0], $this->context, $this->migrationContext);
- $this->converter->writeMapping($this->context);
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertNull($convertResult->getMappingUuid());
- }
-
- public function testConvertWithoutSalesChannel(): void
- {
- $data = require __DIR__ . '/../../../_fixtures/customer_wishlist.php';
- $data[0]['subshopID'] = '99';
-
- $convertResult = $this->converter->convert($data[0], $this->context, $this->migrationContext);
- $this->converter->writeMapping($this->context);
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertNull($convertResult->getMappingUuid());
- }
}
diff --git a/tests/Profile/Shopware55/Converter/LanguageConverterTest.php b/tests/Profile/Shopware55/Converter/LanguageConverterTest.php
index bee77f357..b00d606b3 100644
--- a/tests/Profile/Shopware55/Converter/LanguageConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/LanguageConverterTest.php
@@ -21,7 +21,6 @@
use SwagMigrationAssistant\Profile\Shopware55\Shopware55Profile;
use SwagMigrationAssistant\Test\Mock\Migration\Logging\DummyLoggingService;
use SwagMigrationAssistant\Test\Mock\Migration\Mapping\BasicSettingsMappingService;
-use SwagMigrationAssistant\Test\Mock\Migration\Mapping\DummyMappingService;
#[Package('fundamentals@after-sales')]
class LanguageConverterTest extends TestCase
@@ -40,8 +39,8 @@ protected function setUp(): void
$this->converter = new Shopware55LanguageConverter(
new BasicSettingsMappingService(),
$this->loggingService,
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(LocaleLookup::class),
+ static::getContainer()->get(LocaleLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
);
$runId = Uuid::randomHex();
@@ -73,6 +72,7 @@ public function testConvert(): void
$context = Context::createDefaultContext();
$convertResult = $this->converter->convert($languageData[0], $context, $this->migrationContext);
+ static::assertNotNull($convertResult);
$this->converter->writeMapping($context);
$converted = $convertResult->getConverted();
static::assertNotNull($converted);
@@ -83,28 +83,4 @@ public function testConvert(): void
static::assertSame('Niederländisch', $converted['name']);
static::assertSame($converted['translationCodeId'], $converted['localeId']);
}
-
- public function testConvertWhichExists(): void
- {
- $languageData = require __DIR__ . '/../../../_fixtures/language_data.php';
-
- $languageLookupMock = $this->createMock(LanguageLookup::class);
- $languageLookupMock->method('get')->willReturn('test-uuid');
-
- $context = Context::createDefaultContext();
- $this->converter = new Shopware55LanguageConverter(
- new DummyMappingService(),
- $this->loggingService,
- $languageLookupMock,
- $this->createMock(LocaleLookup::class)
- );
- $convertResult = $this->converter->convert($languageData[0], $context, $this->migrationContext);
- $this->converter->writeMapping($context);
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
-
- $logs = $this->loggingService->getLoggingArray();
- static::assertSame('SWAG_MIGRATION_ENTITY_ALREADY_EXISTS', $logs[0]['code']);
- }
}
diff --git a/tests/Profile/Shopware55/Converter/MainVariantRelationConverterTest.php b/tests/Profile/Shopware55/Converter/MainVariantRelationConverterTest.php
index 0fafcd270..572080f71 100644
--- a/tests/Profile/Shopware55/Converter/MainVariantRelationConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/MainVariantRelationConverterTest.php
@@ -114,51 +114,20 @@ public function testConvert(): void
$context = Context::createDefaultContext();
$convertResult = $this->converter->convert($data[0], $context, $this->migrationContext);
$this->converter->writeMapping($context);
- $converted = $convertResult->getConverted();
+ $converted = $convertResult?->getConverted();
- static::assertNull($convertResult->getUnmapped());
+ static::assertNull($convertResult?->getUnmapped());
static::assertNotNull($converted);
static::assertSame($this->productContainer1['entityId'], $converted['id']);
static::assertSame($this->productVariant1['entityId'], $converted['variantListingConfig']['mainVariantId']);
$convertResult = $this->converter->convert($data[1], $context, $this->migrationContext);
$this->converter->writeMapping($context);
- $converted = $convertResult->getConverted();
+ $converted = $convertResult?->getConverted();
- static::assertNull($convertResult->getUnmapped());
+ static::assertNull($convertResult?->getUnmapped());
static::assertNotNull($converted);
static::assertSame($this->productContainer2['entityId'], $converted['id']);
static::assertSame($this->productVariant2['entityId'], $converted['variantListingConfig']['mainVariantId']);
}
-
- public function testConvertWithoutMapping(): void
- {
- $data = require __DIR__ . '/../../../_fixtures/main_variant_relation.php';
- $context = Context::createDefaultContext();
- $raw1 = $data[0];
- $raw2 = $data[0];
-
- $raw1['id'] = 'invalid-id';
- $convertResult = $this->converter->convert($raw1, $context, $this->migrationContext);
- $this->converter->writeMapping($context);
- $converted = $convertResult->getConverted();
-
- $logs = $this->loggingService->getLoggingArray();
- static::assertNotNull($convertResult->getUnmapped());
- static::assertNull($converted);
- static::assertCount(1, $logs);
- static::assertSame('SWAG_MIGRATION__SHOPWARE_ASSOCIATION_REQUIRED_MISSING', $logs[0]['code']);
-
- $this->loggingService->resetLogging();
- $raw2['ordernumber'] = 'invalid-ordernumber';
- $convertResult = $this->converter->convert($raw2, $context, $this->migrationContext);
- $this->converter->writeMapping($context);
- $converted = $convertResult->getConverted();
-
- $logs = $this->loggingService->getLoggingArray();
- static::assertNotNull($convertResult->getUnmapped());
- static::assertNull($converted);
- static::assertCount(1, $logs);
- static::assertSame('SWAG_MIGRATION__SHOPWARE_ASSOCIATION_REQUIRED_MISSING', $logs[0]['code']);
- }
}
diff --git a/tests/Profile/Shopware55/Converter/MediaConverterTest.php b/tests/Profile/Shopware55/Converter/MediaConverterTest.php
index c756735da..2c73c93cc 100644
--- a/tests/Profile/Shopware55/Converter/MediaConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/MediaConverterTest.php
@@ -39,7 +39,7 @@ protected function setUp(): void
$mappingService,
new DummyLoggingService(),
$mediaFileService,
- $this->getContainer()->get(LanguageLookup::class)
+ static::getContainer()->get(LanguageLookup::class)
);
$runId = Uuid::randomHex();
diff --git a/tests/Profile/Shopware55/Converter/MediaFolderConverterTest.php b/tests/Profile/Shopware55/Converter/MediaFolderConverterTest.php
index 2c8c294e4..d5cb99198 100644
--- a/tests/Profile/Shopware55/Converter/MediaFolderConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/MediaFolderConverterTest.php
@@ -37,8 +37,8 @@ protected function setUp(): void
$this->converter = new Shopware55MediaFolderConverter(
new DummyMappingService(),
$loggingService,
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(MediaThumbnailSizeLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(MediaThumbnailSizeLookup::class),
);
$runId = Uuid::randomHex();
diff --git a/tests/Profile/Shopware55/Converter/NewsletterRecipientConverterTest.php b/tests/Profile/Shopware55/Converter/NewsletterRecipientConverterTest.php
index f45d56585..ca8705a71 100644
--- a/tests/Profile/Shopware55/Converter/NewsletterRecipientConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/NewsletterRecipientConverterTest.php
@@ -42,7 +42,7 @@ protected function setUp(): void
$this->newsletterReceiverConverter = new Shopware55NewsletterRecipientConverter(
$mappingService,
$this->loggingService,
- $this->getContainer()->get(LanguageLookup::class)
+ static::getContainer()->get(LanguageLookup::class)
);
$runId = Uuid::randomHex();
@@ -92,30 +92,6 @@ protected function setUp(): void
);
}
- public function testConvertWithoutDoubleOptinConfirmed(): void
- {
- $customerData = require __DIR__ . '/../../../_fixtures/invalid/newsletter_recipient_data.php';
-
- $context = Context::createDefaultContext();
- $customerData = $customerData[1];
- $customerData['address']['double_optin_confirmed'] = null;
- $customerData['address']['salutation'] = 'mr';
- $customerData['double_optin_confirmed'] = null;
-
- $convertResult = $this->newsletterReceiverConverter->convert(
- $customerData,
- $context,
- $this->context
- );
-
- static::assertNull($convertResult->getConverted());
-
- $logs = $this->loggingService->getLoggingArray();
- static::assertCount(1, $logs);
-
- static::assertSame($logs[0]['code'], 'SWAG_MIGRATION_EMPTY_NECESSARY_FIELD');
- }
-
public function testConvertWithNotExistingSalutation(): void
{
$data = require __DIR__ . '/../../../_fixtures/invalid/newsletter_recipient_data.php';
diff --git a/tests/Profile/Shopware55/Converter/NumberRangeConverterTest.php b/tests/Profile/Shopware55/Converter/NumberRangeConverterTest.php
index 1747507da..2243a01ae 100644
--- a/tests/Profile/Shopware55/Converter/NumberRangeConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/NumberRangeConverterTest.php
@@ -40,8 +40,8 @@ protected function setUp(): void
$mappingService,
$loggingService,
$numberRangeRepo,
- $this->getContainer()->get(NumberRangeLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(NumberRangeLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
);
$runId = Uuid::randomHex();
@@ -138,16 +138,4 @@ public function testConvert(): void
static::assertSame('SW{n}', $converted['pattern']);
static::assertSame(50006, $converted['start']);
}
-
- public function testConvertWithUnknownType(): void
- {
- $numberRangeData = require __DIR__ . '/../../../_fixtures/number_range_data.php';
-
- $context = Context::createDefaultContext();
- $convertResult = $this->converter->convert($numberRangeData[2], $context, $this->migrationContext);
- $this->converter->writeMapping($context);
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- }
}
diff --git a/tests/Profile/Shopware55/Converter/OrderConverterTest.php b/tests/Profile/Shopware55/Converter/OrderConverterTest.php
index c5eb150d9..ce4ff69be 100644
--- a/tests/Profile/Shopware55/Converter/OrderConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/OrderConverterTest.php
@@ -85,10 +85,10 @@ protected function setUp(): void
$this->loggingService,
$taxCalculator,
$salesChannelRepo,
- $this->getContainer()->get(CountryLookup::class),
+ static::getContainer()->get(CountryLookup::class),
$currencyLookup,
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(CountryStateLookup::class)
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(CountryStateLookup::class)
);
$this->customerConverter = new Shopware55CustomerConverter(
@@ -393,26 +393,21 @@ public function testConvertWithoutRequiredProperties(string $missingProperty): v
$this->migrationContext
);
- static::assertNull($convertResult->getConverted());
-
- $logs = $this->loggingService->getLoggingArray();
- static::assertCount(1, $logs);
-
- static::assertSame($logs[0]['code'], 'SWAG_MIGRATION_EMPTY_NECESSARY_FIELD');
+ static::assertNotNull($convertResult->getConverted());
}
/**
- * @return list>
+ * @return array
*/
public static function requiredProperties(): array
{
return [
- ['billingaddress'],
- ['payment'],
- ['customer'],
- ['currencyFactor'],
- ['currency'],
- ['status'],
+ 'billingaddress' => ['billingaddress'],
+ 'payment' => ['payment'],
+ 'customer' => ['customer'],
+ 'currencyFactor' => ['currencyFactor'],
+ 'currency' => ['currency'],
+ 'status' => ['status'],
];
}
@@ -577,17 +572,7 @@ public function testConvertWithoutValidBillingAddress(string $missingAddressProp
$converted = $convertResult->getConverted();
- static::assertNull($converted);
- static::assertCount(2, $this->loggingService->getLoggingArray());
-
- $validLog = 0;
- foreach ($this->loggingService->getLoggingArray() as $log) {
- if ($log['code'] === 'SWAG_MIGRATION_EMPTY_NECESSARY_FIELD') {
- ++$validLog;
- }
- }
-
- static::assertSame(2, $validLog);
+ static::assertNotNull($converted);
}
#[DataProvider('requiredAddressProperties')]
@@ -617,71 +602,12 @@ public function testConvertWithoutValidShippingAddress(string $missingProperty):
static::assertArrayHasKey('id', $converted);
static::assertSame(TestDefaults::SALES_CHANNEL, $converted['salesChannelId']);
static::assertSame('test@example.com', $converted['orderCustomer']['email']);
- static::assertCount(1, $this->loggingService->getLoggingArray());
foreach ($this->loggingService->getLoggingArray() as $log) {
static::assertSame('SWAG_MIGRATION_EMPTY_NECESSARY_FIELD', $log['code']);
}
}
- public function testConvertWithoutPaymentName(): void
- {
- [$customerData, $orderData] = $this->getFixtureData();
- $orderData = $orderData[0];
- unset($orderData['payment']['name']);
- $context = Context::createDefaultContext();
-
- $this->customerConverter->convert(
- $customerData[0],
- $context,
- $this->customerMigrationContext
- );
-
- $convertResult = $this->orderConverter->convert(
- $orderData,
- $context,
- $this->migrationContext
- );
-
- $converted = $convertResult->getConverted();
-
- static::assertNull($converted);
- static::assertCount(1, $this->loggingService->getLoggingArray());
-
- foreach ($this->loggingService->getLoggingArray() as $log) {
- static::assertSame('SWAG_MIGRATION_EMPTY_NECESSARY_FIELD', $log['code']);
- }
- }
-
- public function testConvertWithoutKnownOrderState(): void
- {
- [$customerData, $orderData] = $this->getFixtureData();
- $orderData = $orderData[0];
- $orderData['status'] = 100;
- $context = Context::createDefaultContext();
-
- $this->customerConverter->convert(
- $customerData[0],
- $context,
- $this->customerMigrationContext
- );
-
- $convertResult = $this->orderConverter->convert(
- $orderData,
- $context,
- $this->migrationContext
- );
-
- $converted = $convertResult->getConverted();
-
- static::assertNull($converted);
- static::assertCount(1, $this->loggingService->getLoggingArray());
-
- foreach ($this->loggingService->getLoggingArray() as $log) {
- static::assertSame('SWAG_MIGRATION_ENTITY_UNKNOWN', $log['code']);
- }
- }
-
public function testConvertWithOrderLanguage(): void
{
[$customerData, $orderData] = $this->getFixtureData();
@@ -707,7 +633,7 @@ public function testConvertWithOrderLanguage(): void
$this->loggingService,
new TaxCalculator(),
static::getContainer()->get('sales_channel.repository'),
- $this->getContainer()->get(CountryLookup::class),
+ static::getContainer()->get(CountryLookup::class),
$currencyLookup,
$languageLookup,
$this->createMock(CountryStateLookup::class)
@@ -809,7 +735,7 @@ public function testConvertCountryStateWithMapping(): void
$criteria = new Criteria();
$criteria->addFilter(new EqualsFilter('shortCode', 'DE-NW'));
- $expectedStateId = $this->getContainer()->get('country_state.repository')->searchIds($criteria, $context)->firstId();
+ $expectedStateId = static::getContainer()->get('country_state.repository')->searchIds($criteria, $context)->firstId();
static::assertNotNull($converted);
static::assertArrayHasKey('id', $converted);
@@ -850,7 +776,7 @@ public function testConvertExistingCountryStateWithoutMapping(): void
$criteria = new Criteria();
$criteria->addFilter(new EqualsFilter('shortCode', 'DE-NW'));
- $expectedStateId = $this->getContainer()->get('country_state.repository')->searchIds($criteria, $context)->firstId();
+ $expectedStateId = static::getContainer()->get('country_state.repository')->searchIds($criteria, $context)->firstId();
static::assertNotNull($converted);
static::assertArrayHasKey('id', $converted);
diff --git a/tests/Profile/Shopware55/Converter/ProductConverterTest.php b/tests/Profile/Shopware55/Converter/ProductConverterTest.php
index dc489f352..6c4c1873d 100644
--- a/tests/Profile/Shopware55/Converter/ProductConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/ProductConverterTest.php
@@ -55,10 +55,10 @@ protected function setUp(): void
$this->mappingService,
$this->loggingService,
$mediaFileService,
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class),
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class),
);
$runId = Uuid::randomHex();
@@ -199,9 +199,9 @@ public function testConvertWithCategory(): void
$this->mappingService,
$this->loggingService,
$mediaFileService,
- $this->getContainer()->get(LowestRootCategoryLookup::class),
- $this->getContainer()->get(DefaultCmsPageLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(LowestRootCategoryLookup::class),
+ static::getContainer()->get(DefaultCmsPageLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
);
$categoryData = require __DIR__ . '/../../../_fixtures/category_data.php';
$productData = require __DIR__ . '/../../../_fixtures/product_data.php';
diff --git a/tests/Profile/Shopware55/Converter/ProductOptionRelationConverterTest.php b/tests/Profile/Shopware55/Converter/ProductOptionRelationConverterTest.php
index c24068380..6d3134912 100644
--- a/tests/Profile/Shopware55/Converter/ProductOptionRelationConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/ProductOptionRelationConverterTest.php
@@ -155,48 +155,4 @@ public function testConvertWithOldRelationMapping(): void
static::assertSame($this->propertyUuids[0], $converted['configuratorSettings'][0]['optionId']);
static::assertSame($this->oldMappingId, $converted['configuratorSettings'][0]['id']);
}
-
- public function testConvertWithoutProductMapping(): void
- {
- $data = require __DIR__ . '/../../../_fixtures/product_option_relation.php';
- $data = $data[0];
- $data['productId'] = '18';
-
- $context = Context::createDefaultContext();
- $convertResult = $this->converter->convert($data, $context, $this->migrationContext);
- $this->converter->writeMapping($context);
- $logs = $this->loggingService->getLoggingArray();
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertEmpty($logs);
- }
-
- public function testConvertWithoutPropertyMapping(): void
- {
- $relations = require __DIR__ . '/../../../_fixtures/product_option_relation.php';
- $data = $relations[0];
- $data['name'] = 'Invalid property value';
-
- $context = Context::createDefaultContext();
- $convertResult = $this->converter->convert($data, $context, $this->migrationContext);
- $this->converter->writeMapping($context);
- $logs = $this->loggingService->getLoggingArray();
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertEmpty($logs);
-
- $data = $relations[0];
- $data['group']['name'] = 'Invalid group name';
-
- $context = Context::createDefaultContext();
- $convertResult = $this->converter->convert($data, $context, $this->migrationContext);
- $this->converter->writeMapping($context);
- $logs = $this->loggingService->getLoggingArray();
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertEmpty($logs);
- }
}
diff --git a/tests/Profile/Shopware55/Converter/ProductPropertyRelationConverterTest.php b/tests/Profile/Shopware55/Converter/ProductPropertyRelationConverterTest.php
index 2ff6f6959..38c47a8df 100644
--- a/tests/Profile/Shopware55/Converter/ProductPropertyRelationConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/ProductPropertyRelationConverterTest.php
@@ -101,6 +101,7 @@ public function testConvert(): void
static::assertNull($convertResult->getUnmapped());
static::assertNotNull($convertResult->getMappingUuid());
+
static::assertSame($this->productUuid, $converted['id']);
static::assertSame($this->propertyUuids[0], $converted['properties'][0]['id']);
@@ -124,48 +125,4 @@ public function testConvert(): void
static::assertSame($this->productUuid, $converted['id']);
static::assertSame($this->propertyUuids[2], $converted['properties'][0]['id']);
}
-
- public function testConvertWithoutProductMapping(): void
- {
- $data = require __DIR__ . '/../../../_fixtures/product_property_relation.php';
- $data = $data[0];
- $data['productId'] = '18';
-
- $context = Context::createDefaultContext();
- $convertResult = $this->converter->convert($data, $context, $this->migrationContext);
- $this->converter->writeMapping($context);
- $logs = $this->loggingService->getLoggingArray();
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertEmpty($logs);
- }
-
- public function testConvertWithoutPropertyMapping(): void
- {
- $relations = require __DIR__ . '/../../../_fixtures/product_property_relation.php';
- $data = $relations[0];
- $data['name'] = 'Invalid property value';
-
- $context = Context::createDefaultContext();
- $convertResult = $this->converter->convert($data, $context, $this->migrationContext);
- $this->converter->writeMapping($context);
- $logs = $this->loggingService->getLoggingArray();
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertEmpty($logs);
-
- $data = $relations[0];
- $data['group']['name'] = 'Invalid group name';
-
- $context = Context::createDefaultContext();
- $convertResult = $this->converter->convert($data, $context, $this->migrationContext);
- $this->converter->writeMapping($context);
- $logs = $this->loggingService->getLoggingArray();
-
- static::assertNull($convertResult->getConverted());
- static::assertNotNull($convertResult->getUnmapped());
- static::assertEmpty($logs);
- }
}
diff --git a/tests/Profile/Shopware55/Converter/ProductReviewConverterTest.php b/tests/Profile/Shopware55/Converter/ProductReviewConverterTest.php
index e06378388..9e29c30dc 100644
--- a/tests/Profile/Shopware55/Converter/ProductReviewConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/ProductReviewConverterTest.php
@@ -54,7 +54,7 @@ protected function setUp(): void
$this->converter = new Shopware55ProductReviewConverter(
$mappingService,
$loggingService,
- $this->getContainer()->get(LanguageLookup::class)
+ static::getContainer()->get(LanguageLookup::class)
);
$connectionId = Uuid::randomHex();
diff --git a/tests/Profile/Shopware55/Converter/PropertyGroupOptionConverterTest.php b/tests/Profile/Shopware55/Converter/PropertyGroupOptionConverterTest.php
index d23271dbb..2dbb59f9c 100644
--- a/tests/Profile/Shopware55/Converter/PropertyGroupOptionConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/PropertyGroupOptionConverterTest.php
@@ -64,17 +64,17 @@ protected function setUp(): void
$this->mappingService,
$this->loggingService,
$mediaFileService,
- $this->getContainer()->get(LanguageLookup::class)
+ static::getContainer()->get(LanguageLookup::class)
);
$this->productConverter = new Shopware55ProductConverter(
$this->mappingService,
$this->loggingService,
$mediaFileService,
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$this->optionRelationConverter = new Shopware55ProductOptionRelationConverter(
diff --git a/tests/Profile/Shopware55/Converter/SalesChannelConverterTest.php b/tests/Profile/Shopware55/Converter/SalesChannelConverterTest.php
index cf710474f..e0effd58f 100644
--- a/tests/Profile/Shopware55/Converter/SalesChannelConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/SalesChannelConverterTest.php
@@ -59,7 +59,7 @@ protected function setUp(): void
$countryRepo,
$salesChannelRepo,
null,
- $this->getContainer()->get(CurrencyLookup::class),
+ static::getContainer()->get(CurrencyLookup::class),
$languageLookup,
);
diff --git a/tests/Profile/Shopware55/Converter/ShippingMethodConverterTest.php b/tests/Profile/Shopware55/Converter/ShippingMethodConverterTest.php
index 0a5d5e148..4b48195da 100644
--- a/tests/Profile/Shopware55/Converter/ShippingMethodConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/ShippingMethodConverterTest.php
@@ -66,8 +66,8 @@ protected function setUp(): void
$this->shippingMethodConverter = new Shopware55ShippingMethodConverter(
$this->mappingService,
$this->loggingService,
- $this->getContainer()->get(CountryLookup::class),
- $this->getContainer()->get(LanguageLookup::class)
+ static::getContainer()->get(CountryLookup::class),
+ static::getContainer()->get(LanguageLookup::class)
);
$runId = Uuid::randomHex();
@@ -141,7 +141,7 @@ public function testConvert(): void
$shippingMethodConverter = new Shopware55ShippingMethodConverter(
$this->mappingService,
$this->loggingService,
- $this->getContainer()->get(CountryLookup::class),
+ static::getContainer()->get(CountryLookup::class),
$languageLookup
);
diff --git a/tests/Profile/Shopware55/Converter/TranslationConverterTest.php b/tests/Profile/Shopware55/Converter/TranslationConverterTest.php
index 79f958a2c..91d06d2f6 100644
--- a/tests/Profile/Shopware55/Converter/TranslationConverterTest.php
+++ b/tests/Profile/Shopware55/Converter/TranslationConverterTest.php
@@ -156,10 +156,10 @@ public function testConvertProductTranslation(): void
$this->mappingService,
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$productConverter->convert($productData[0], $context, $this->productMigrationContext);
@@ -217,10 +217,10 @@ public function testConvertManufacturerTranslation(): void
$this->mappingService,
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$productConvertResult = $productConverter->convert($productData[0], $context, $this->productMigrationContext);
@@ -261,10 +261,10 @@ public function testConvertManufacturerTranslationWithInvalidTranslationObject()
$this->mappingService,
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$productConverter->convert($productData[0], $context, $this->productMigrationContext);
@@ -290,10 +290,10 @@ public function testConvertUnitTranslation(): void
$this->mappingService,
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$productConvertResult = $productConverter->convert($productData[0], $context, $this->productMigrationContext);
@@ -335,10 +335,10 @@ public function testConvertUnitTranslationWithInvalidTranslationObject(): void
$this->mappingService,
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$productConverter->convert($productData[0], $context, $this->productMigrationContext);
@@ -365,9 +365,9 @@ public function testConvertCategoryTranslation(): void
$this->mappingService,
$this->loggingService,
$mediaFileService,
- $this->getContainer()->get(LowestRootCategoryLookup::class),
- $this->getContainer()->get(DefaultCmsPageLookup::class),
- $this->getContainer()->get(LanguageLookup::class)
+ static::getContainer()->get(LowestRootCategoryLookup::class),
+ static::getContainer()->get(DefaultCmsPageLookup::class),
+ static::getContainer()->get(LanguageLookup::class)
);
$categoryConvertResult = $categoryConverter->convert($categoryData[1], $context, $this->categoryMigrationContext);
@@ -411,9 +411,9 @@ public function testConvertCategoryAttributeTranslation(): void
$this->mappingService,
$this->loggingService,
$mediaFileService,
- $this->getContainer()->get(LowestRootCategoryLookup::class),
- $this->getContainer()->get(DefaultCmsPageLookup::class),
- $this->getContainer()->get(LanguageLookup::class)
+ static::getContainer()->get(LowestRootCategoryLookup::class),
+ static::getContainer()->get(DefaultCmsPageLookup::class),
+ static::getContainer()->get(LanguageLookup::class)
);
$categoryConvertResult = $categoryConverter->convert($categoryData[1], $context, $this->categoryMigrationContext);
@@ -480,9 +480,9 @@ public function testConvertCategoryTranslationWithInvalidTranslationObject(): vo
$this->mappingService,
$this->loggingService,
$mediaFileService,
- $this->getContainer()->get(LowestRootCategoryLookup::class),
- $this->getContainer()->get(DefaultCmsPageLookup::class),
- $this->getContainer()->get(LanguageLookup::class)
+ static::getContainer()->get(LowestRootCategoryLookup::class),
+ static::getContainer()->get(DefaultCmsPageLookup::class),
+ static::getContainer()->get(LanguageLookup::class)
);
$categoryConverter->convert($categoryData[1], $context, $this->categoryMigrationContext);
@@ -599,20 +599,20 @@ public function testConvertProductWithoutLocale(): void
$this->mappingService,
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$productConverter->convert($productData[0], $context, $this->productMigrationContext);
$translationData = require __DIR__ . '/../../../_fixtures/translation_data.php';
$convertResult = $this->translationConverter->convert($translationData['productnolocale'], $context, $this->migrationContext);
- static::assertNull($convertResult->getConverted());
- static::assertCount(1, $this->loggingService->getLoggingArray());
- $logs = $this->loggingService->getLoggingArray();
- static::assertSame('SWAG_MIGRATION_EMPTY_NECESSARY_FIELD', $logs[0]['code']);
+ $converted = $convertResult->getConverted();
+ static::assertNotNull($converted);
+ static::assertArrayHasKey('id', $converted);
+ static::assertArrayHasKey('entityDefinitionClass', $converted);
}
public function testConvertVariantAttributeTranslation(): void
@@ -626,10 +626,10 @@ public function testConvertVariantAttributeTranslation(): void
$this->mappingService,
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$productConverter->convert($productData[0], $context, $this->productMigrationContext);
@@ -762,10 +762,10 @@ public function testConvertProductTranslationsWithSeoData(): void
$this->mappingService,
$this->loggingService,
new DummyMediaFileService(),
- $this->getContainer()->get(TaxLookup::class),
- $this->getContainer()->get(MediaDefaultFolderLookup::class),
- $this->getContainer()->get(LanguageLookup::class),
- $this->getContainer()->get(DeliveryTimeLookup::class)
+ static::getContainer()->get(TaxLookup::class),
+ static::getContainer()->get(MediaDefaultFolderLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(DeliveryTimeLookup::class)
);
$productConverter->convert($productData[0], $context, $this->productMigrationContext);
diff --git a/tests/Profile/Shopware6/Converter/LanguageConverterConvertDataTest.php b/tests/Profile/Shopware6/Converter/LanguageConverterConvertDataTest.php
index 559e23a42..71d47e5d7 100644
--- a/tests/Profile/Shopware6/Converter/LanguageConverterConvertDataTest.php
+++ b/tests/Profile/Shopware6/Converter/LanguageConverterConvertDataTest.php
@@ -52,7 +52,7 @@ public function testConvertData(): void
];
$result = $languageConverter->convert($data, $context, $migrationContext);
- $converted = $result->getConverted() ?? [];
+ $converted = $result?->getConverted() ?? [];
static::assertArrayHasKey('id', $converted);
static::assertSame($languageId, $converted['id']);
@@ -80,7 +80,7 @@ public function testConvertDataShouldNotOverwriteTheDefaultLanguage(): void
];
$result = $languageConverter->convert($data, $context, $migrationContext);
- $converted = $result->getConverted() ?? [];
+ $converted = $result?->getConverted() ?? [];
static::assertArrayHasKey('id', $converted);
static::assertNotSame($defaultLanguageId, $converted['id']);
@@ -106,7 +106,7 @@ public function testCheckDataForDefaultLanguageShouldReturnDataUnchangedWitNoDef
$languageConverter = $this->createLanguageConverter($mappingServiceMock, null, $languageLookupMock);
$result = $languageConverter->convert($data, $context, $migrationContext);
- $converted = $result->getConverted() ?? [];
+ $converted = $result?->getConverted() ?? [];
static::assertArrayHasKey('id', $converted);
static::assertSame($expectedId, $converted['id']);
@@ -133,7 +133,7 @@ public function testCheckDataForDefaultLanguageShouldReturnDataUnchangedWitNoDef
$languageConverter = $this->createLanguageConverter($mappingServiceMock);
$result = $languageConverter->convert($data, $context, $migrationContext);
- $converted = $result->getConverted() ?? [];
+ $converted = $result?->getConverted() ?? [];
static::assertArrayHasKey('id', $converted);
static::assertSame($expectedId, $converted['id']);
@@ -148,8 +148,8 @@ private function createLanguageConverter(
return new LanguageConverter(
$mappingService ?? new Dummy6MappingService(),
$loggingService ?? $this->createMock(LoggingServiceInterface::class),
- $languageLookup ?? $this->getContainer()->get(LanguageLookup::class),
- $localeLookup ?? $this->getContainer()->get(LocaleLookup::class)
+ $languageLookup ?? static::getContainer()->get(LanguageLookup::class),
+ $localeLookup ?? static::getContainer()->get(LocaleLookup::class)
);
}
diff --git a/tests/Profile/Shopware6/Converter/LanguageConverterTest.php b/tests/Profile/Shopware6/Converter/LanguageConverterTest.php
index 639ee685d..1c0d67d36 100644
--- a/tests/Profile/Shopware6/Converter/LanguageConverterTest.php
+++ b/tests/Profile/Shopware6/Converter/LanguageConverterTest.php
@@ -34,7 +34,7 @@ protected function createConverter(
return new LanguageConverter(
$mappingService,
$loggingService,
- $this->getContainer()->get(LanguageLookup::class),
+ static::getContainer()->get(LanguageLookup::class),
$localeLookup
);
}
diff --git a/tests/Profile/Shopware6/Converter/NumberRangeConverterTest.php b/tests/Profile/Shopware6/Converter/NumberRangeConverterTest.php
index aab7ad1c7..e7b90b669 100644
--- a/tests/Profile/Shopware6/Converter/NumberRangeConverterTest.php
+++ b/tests/Profile/Shopware6/Converter/NumberRangeConverterTest.php
@@ -45,7 +45,7 @@ protected function createConverter(
return new NumberRangeConverter(
$mappingService,
$loggingService,
- $this->getContainer()->get('number_range_state.repository'),
+ static::getContainer()->get('number_range_state.repository'),
$numberRangeLookup,
$numberRangeTypeLookup
);
diff --git a/tests/Profile/Shopware6/Converter/SalesChannelConverterTest.php b/tests/Profile/Shopware6/Converter/SalesChannelConverterTest.php
index 054d63776..d31fd732f 100644
--- a/tests/Profile/Shopware6/Converter/SalesChannelConverterTest.php
+++ b/tests/Profile/Shopware6/Converter/SalesChannelConverterTest.php
@@ -11,6 +11,7 @@
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Log\Package;
use SwagMigrationAssistant\Migration\Converter\ConverterInterface;
+use SwagMigrationAssistant\Migration\Converter\ConvertStruct;
use SwagMigrationAssistant\Migration\DataSelection\DataSet\DataSet;
use SwagMigrationAssistant\Migration\Logging\LoggingServiceInterface;
use SwagMigrationAssistant\Migration\Mapping\MappingServiceInterface;
@@ -44,6 +45,7 @@ public function testConvert(string $fixtureFolderPath): void
$context = Context::createDefaultContext();
$convertResult = $this->converter->convert($input, $context, $this->migrationContext);
+ static::assertInstanceOf(ConvertStruct::class, $convertResult);
$output = $convertResult->getConverted();
static::assertNotNull($output);
diff --git a/tests/Profile/Shopware6/Converter/SeoUrlConverterConvertDataTest.php b/tests/Profile/Shopware6/Converter/SeoUrlConverterConvertDataTest.php
index eca23847e..997657af9 100644
--- a/tests/Profile/Shopware6/Converter/SeoUrlConverterConvertDataTest.php
+++ b/tests/Profile/Shopware6/Converter/SeoUrlConverterConvertDataTest.php
@@ -23,16 +23,15 @@ class SeoUrlConverterConvertDataTest extends TestCase
{
use IntegrationTestBehaviour;
- public function testConvertSkipConvertionIfSeoUrlIsUnmodified(): void
+ public function testConvertIfSeoUrlIsUnmodified(): void
{
$data = [
'isModified' => false,
];
$seoUrlConverter = $this->createSeoUrlConverter();
- $result = $seoUrlConverter->convert($data, Context::createDefaultContext(), $this->createMigrationContext());
- static::assertNull($result->getConverted());
- static::assertSame($data, $result->getUnmapped());
+
+ static::assertNull($seoUrlConverter->convert($data, Context::createDefaultContext(), $this->createMigrationContext()));
}
private function createSeoUrlConverter(): SeoUrlConverter
diff --git a/tests/Profile/Shopware6/Converter/ShopwareConverterTest.php b/tests/Profile/Shopware6/Converter/ShopwareConverterTest.php
index fe76c80b5..6d9bd13da 100644
--- a/tests/Profile/Shopware6/Converter/ShopwareConverterTest.php
+++ b/tests/Profile/Shopware6/Converter/ShopwareConverterTest.php
@@ -111,12 +111,13 @@ public function testConvert(string $fixtureFolderPath): void
$context = Context::createDefaultContext();
$convertResult = $this->converter->convert($input, $context, $this->migrationContext);
- $output = $convertResult->getConverted();
+ $output = $convertResult?->getConverted();
$fixtureName = \basename($fixtureFolderPath);
if ($output !== null) {
- static::assertNotNull($convertResult->getMappingUuid(), $this->getAssertMessage($fixtureName . ': No mappingUuid in converted result struct.'));
+ static::assertNotNull($convertResult?->getMappingUuid(), $this->getAssertMessage($fixtureName . ': No mappingUuid in converted result struct.'));
}
+
static::assertSame($expectedOutput, $output, $this->getAssertMessage($fixtureName . ': Output of converter does not match.'));
$logs = $this->loggingService->getLoggingArray();
@@ -127,6 +128,7 @@ public function testConvert(string $fixtureFolderPath): void
$realLog = $logs[$index];
foreach (\array_keys($expectedLog) as $key) {
+ static::assertArrayHasKey($key, $realLog, $fixtureName . ': Array key: "' . $key . '" not found in converted log result.');
static::assertSame($expectedLog[$key], $realLog[$key], $this->getAssertMessage($fixtureName . ': Log key not as expected (make sure the log array order matches the logging order).'));
}
}
diff --git a/tests/ServiceCorrectArgumentsTest.php b/tests/ServiceCorrectArgumentsTest.php
index 43cb4d9b0..9f289e6f1 100644
--- a/tests/ServiceCorrectArgumentsTest.php
+++ b/tests/ServiceCorrectArgumentsTest.php
@@ -21,7 +21,7 @@ class ServiceCorrectArgumentsTest extends TestCase
#[DataProvider('serviceProvider')]
public function testServiceShouldHaveCorrectArgumentsInContainer(string $xmlPath, string $serviceId): void
{
- $service = $this->getContainer()->get($serviceId);
+ $service = static::getContainer()->get($serviceId);
static::assertNotNull($service);
}
diff --git a/tests/_fixtures/Shopware6/CmsPage/03-LockedLayouts/log.php b/tests/_fixtures/Shopware6/CmsPage/03-LockedLayouts/log.php
new file mode 100644
index 000000000..2c3ce3366
--- /dev/null
+++ b/tests/_fixtures/Shopware6/CmsPage/03-LockedLayouts/log.php
@@ -0,0 +1,8 @@
+
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return [];
diff --git a/tests/_fixtures/Shopware6/CustomerWishlist/02-CustomerNotFound/output.php b/tests/_fixtures/Shopware6/CustomerWishlist/02-CustomerNotFound/output.php
index b3b8fd1cb..4d5e8d071 100644
--- a/tests/_fixtures/Shopware6/CustomerWishlist/02-CustomerNotFound/output.php
+++ b/tests/_fixtures/Shopware6/CustomerWishlist/02-CustomerNotFound/output.php
@@ -5,4 +5,35 @@
* file that was distributed with this source code.
*/
-return null;
+return [
+ 'customerId' => null,
+ 'salesChannelId' => 'a8084cf2687b44db91f3277b57cc3d7a',
+ 'products' => [
+ 0 => [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => 'ea56f971f7da442eaaca1be96b4207ee',
+ 'id' => '062b658b0e1b43869c290551b6421738',
+ ],
+ 1 => [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => '41dd1b755e5840fbbe19a632b61c42a0',
+ 'id' => '2f2b5cd9a0e449c79b71889bd494f412',
+ ],
+ 2 => [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => '785485416afc4cc4acf44a607a10f67e',
+ 'id' => '5068f5ad4a744daeba8a0ec68bc3f583',
+ ],
+ 3 => [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => '9abedec2f3784d57b35a3c15a6ae96d1',
+ 'id' => '5a8c6a68750b4942b8da0543813aeb5b',
+ ],
+ 4 => [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => '1ae95316283f43cb917960b5c9822f25',
+ 'id' => '6f8ff63bfebe4e3485626947d8b769ca',
+ ],
+ ],
+ 'id' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+];
diff --git a/tests/_fixtures/Shopware6/CustomerWishlist/03-SalesChannelNotFound/output.php b/tests/_fixtures/Shopware6/CustomerWishlist/03-SalesChannelNotFound/output.php
index b3b8fd1cb..96e855350 100644
--- a/tests/_fixtures/Shopware6/CustomerWishlist/03-SalesChannelNotFound/output.php
+++ b/tests/_fixtures/Shopware6/CustomerWishlist/03-SalesChannelNotFound/output.php
@@ -5,4 +5,35 @@
* file that was distributed with this source code.
*/
-return null;
+return [
+ 'customerId' => '872e88b6d30048e388b018f7a0be6a1e',
+ 'salesChannelId' => null,
+ 'products' => [
+ [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => 'ea56f971f7da442eaaca1be96b4207ee',
+ 'id' => '062b658b0e1b43869c290551b6421738',
+ ],
+ [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => '41dd1b755e5840fbbe19a632b61c42a0',
+ 'id' => '2f2b5cd9a0e449c79b71889bd494f412',
+ ],
+ [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => '785485416afc4cc4acf44a607a10f67e',
+ 'id' => '5068f5ad4a744daeba8a0ec68bc3f583',
+ ],
+ [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => '9abedec2f3784d57b35a3c15a6ae96d1',
+ 'id' => '5a8c6a68750b4942b8da0543813aeb5b',
+ ],
+ [
+ 'wishlistId' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+ 'productId' => '1ae95316283f43cb917960b5c9822f25',
+ 'id' => '6f8ff63bfebe4e3485626947d8b769ca',
+ ],
+ ],
+ 'id' => 'd40f6c0ffe2a4e8a8dec97374920ad51',
+];
diff --git a/tests/_fixtures/Shopware6/MailTemplate/02-MailTypeNotExists/log.php b/tests/_fixtures/Shopware6/MailTemplate/02-MailTypeNotExists/log.php
index 9404a4271..2c3ce3366 100644
--- a/tests/_fixtures/Shopware6/MailTemplate/02-MailTypeNotExists/log.php
+++ b/tests/_fixtures/Shopware6/MailTemplate/02-MailTypeNotExists/log.php
@@ -5,8 +5,4 @@
* file that was distributed with this source code.
*/
-return [
- [
- 'code' => 'SWAG_MIGRATION__SHOPWARE_UNSUPPORTED_MAIL_TEMPLATE_TYPE',
- ],
-];
+return [];
diff --git a/tests/_fixtures/Shopware6/MailTemplate/02-MailTypeNotExists/output.php b/tests/_fixtures/Shopware6/MailTemplate/02-MailTypeNotExists/output.php
index b3b8fd1cb..79cdba237 100644
--- a/tests/_fixtures/Shopware6/MailTemplate/02-MailTypeNotExists/output.php
+++ b/tests/_fixtures/Shopware6/MailTemplate/02-MailTypeNotExists/output.php
@@ -5,4 +5,109 @@
* file that was distributed with this source code.
*/
-return null;
+return [
+ 'id' => 'fee20daa2f2a45178c808f2f69b686d4',
+ 'mailTemplateTypeId' => null,
+ 'systemDefault' => true,
+ 'senderName' => '{{ shopName }}',
+ 'description' => '',
+ 'subject' => 'Password recovery',
+ 'contentHtml' => '
+
+ Hello {{ customerRecovery.customer.firstName }} {{ customerRecovery.customer.lastName }},
+
+ You have requested a new password for your {{ shopName }} account.
+ Click on the following link to reset your password:
+
+ {{ resetUrl }}
+
+ This link is valid for the next 2 hours.
+ If you don\'t want to reset your password, ignore this email and no changes will be made.
+
+ Yours sincerely
+ Your {{ shopName }} team
+
+',
+ 'contentPlain' => ' Hello {{ customerRecovery.customer.firstName }} {{ customerRecovery.customer.lastName }},
+
+ You have requested a new password for your {{ shopName }} account.
+ Click on the following link to reset your password:
+
+ {{ resetUrl }}
+
+ This link is valid for the next 2 hours.
+ If you don\'t want to reset your password, ignore this email and no changes will be made.
+
+ Yours sincerely
+ Your {{ shopName }}-Team',
+ 'translations' => [
+ [
+ 'senderName' => '{{ shopName }}',
+ 'description' => '',
+ 'subject' => 'Password recovery',
+ 'contentHtml' => '
+
+ Hello {{ customerRecovery.customer.firstName }} {{ customerRecovery.customer.lastName }},
+
+ You have requested a new password for your {{ shopName }} account.
+ Click on the following link to reset your password:
+
+ {{ resetUrl }}
+
+ This link is valid for the next 2 hours.
+ If you don\'t want to reset your password, ignore this email and no changes will be made.
+
+ Yours sincerely
+ Your {{ shopName }} team
+
+',
+ 'contentPlain' => ' Hello {{ customerRecovery.customer.firstName }} {{ customerRecovery.customer.lastName }},
+
+ You have requested a new password for your {{ shopName }} account.
+ Click on the following link to reset your password:
+
+ {{ resetUrl }}
+
+ This link is valid for the next 2 hours.
+ If you don\'t want to reset your password, ignore this email and no changes will be made.
+
+ Yours sincerely
+ Your {{ shopName }}-Team',
+ 'languageId' => '5dd637353d044752ae6a8c6e7f53430b',
+ ],
+ [
+ 'senderName' => '{{ shopName }}',
+ 'description' => '',
+ 'subject' => 'Password Wiederherstellung',
+ 'contentHtml' => '
+
+ Hallo {{ customerRecovery.customer.firstName }} {{ customerRecovery.customer.lastName }},
+
+ Sie haben ein neues Passwort für Ihren {{ shopName }}-Account angefordert.
+ Klicken Sie auf folgenden Link, um Ihr Passwort zurückzusetzen:
+
+ {{ resetUrl }}
+
+ Dieser Link ist für die nächsten 2 Stunden gültig.
+ Falls Sie Ihr Passwort nicht zurücksetzen möchten, ignorieren Sie diese E-Mail - es wird dann keine Änderung vorgenommen.
+
+ Mit freundlichen Grüßen
+ Ihr {{ shopName }}-Team
+
+',
+ 'contentPlain' => ' Hallo {{ customerRecovery.customer.firstName }} {{ customerRecovery.customer.lastName }},
+
+ Sie haben ein neues Passwort für Ihren {{ shopName }}-Account angefordert.
+ Klicken Sie auf folgenden Link, um Ihr Passwort zurückzusetzen:
+
+ {{ resetUrl }}
+
+ Dieser Link ist für die nächsten 2 Stunden gültig.
+ Falls Sie Ihr Passwort nicht zurücksetzen möchten, ignorieren Sie diese E-Mail - es wird dann keine Änderung vorgenommen.
+
+ Mit freundlichen Grüßen
+ Ihr {{ shopName }}-Team',
+ 'languageId' => '60d637353d044752ae6a8c6e7f53430b',
+ ],
+ ],
+];
diff --git a/tests/_fixtures/Shopware6/NumberRange/02-TypeNotExists/log.php b/tests/_fixtures/Shopware6/NumberRange/02-TypeNotExists/log.php
index 88da8232a..2c3ce3366 100644
--- a/tests/_fixtures/Shopware6/NumberRange/02-TypeNotExists/log.php
+++ b/tests/_fixtures/Shopware6/NumberRange/02-TypeNotExists/log.php
@@ -5,8 +5,4 @@
* file that was distributed with this source code.
*/
-return [
- [
- 'code' => 'SWAG_MIGRATION__SHOPWARE_UNSUPPORTED_NUMBER_RANGE_TYPE',
- ],
-];
+return [];
diff --git a/tests/_fixtures/Shopware6/NumberRange/02-TypeNotExists/output.php b/tests/_fixtures/Shopware6/NumberRange/02-TypeNotExists/output.php
index b3b8fd1cb..b717c21b8 100644
--- a/tests/_fixtures/Shopware6/NumberRange/02-TypeNotExists/output.php
+++ b/tests/_fixtures/Shopware6/NumberRange/02-TypeNotExists/output.php
@@ -5,4 +5,18 @@
* file that was distributed with this source code.
*/
-return null;
+return [
+ 'id' => '69ed66543f8d401b82040533984e99ee',
+ 'typeId' => null,
+ 'global' => false,
+ 'name' => 'Coole Number Range',
+ 'pattern' => 'cool_{n}_best',
+ 'start' => 100,
+ 'translations' => [
+ [
+ 'numberRangeId' => '69ed66543f8d401b82040533984e99ee',
+ 'name' => 'Coole Number Range',
+ 'languageId' => '5dd637353d044752ae6a8c6e7f53430b',
+ ],
+ ],
+];
diff --git a/tests/integration/Migration/ErrorResolution/MigrationFixTest.php b/tests/integration/Migration/ErrorResolution/MigrationFixTest.php
index 19bce751d..3f9f13e8d 100644
--- a/tests/integration/Migration/ErrorResolution/MigrationFixTest.php
+++ b/tests/integration/Migration/ErrorResolution/MigrationFixTest.php
@@ -43,8 +43,8 @@ class MigrationFixTest extends TestCase
protected function setUp(): void
{
- $this->migrationFixRepository = $this->getContainer()->get('swag_migration_fix.repository');
- $this->connectionRepository = $this->getContainer()->get('swag_migration_connection.repository');
+ $this->migrationFixRepository = static::getContainer()->get('swag_migration_fix.repository');
+ $this->connectionRepository = static::getContainer()->get('swag_migration_connection.repository');
}
#[DataProvider('valueData')]
diff --git a/tests/integration/Migration/Validation/MigrationValidationServiceTest.php b/tests/integration/Migration/Validation/MigrationValidationServiceTest.php
index 76898fbc1..fa4748df4 100644
--- a/tests/integration/Migration/Validation/MigrationValidationServiceTest.php
+++ b/tests/integration/Migration/Validation/MigrationValidationServiceTest.php
@@ -70,14 +70,14 @@ class MigrationValidationServiceTest extends TestCase
protected function setUp(): void
{
- $this->validationService = $this->getContainer()->get(MigrationValidationService::class);
- $this->loggingRepo = $this->getContainer()->get('swag_migration_logging.repository');
- $this->runRepo = $this->getContainer()->get('swag_migration_run.repository');
- $this->mappingRepo = $this->getContainer()->get(SwagMigrationMappingDefinition::ENTITY_NAME . '.repository');
+ $this->validationService = static::getContainer()->get(MigrationValidationService::class);
+ $this->loggingRepo = static::getContainer()->get('swag_migration_logging.repository');
+ $this->runRepo = static::getContainer()->get('swag_migration_run.repository');
+ $this->mappingRepo = static::getContainer()->get(SwagMigrationMappingDefinition::ENTITY_NAME . '.repository');
$this->context = Context::createDefaultContext();
$this->runId = Uuid::randomHex();
- $this->getContainer()->get('swag_migration_connection.repository')->create(
+ static::getContainer()->get('swag_migration_connection.repository')->create(
[
[
'id' => self::CONNECTION_ID,