Skip to content

Commit fe24be0

Browse files
committed
fix: Fix tests
1 parent e844b50 commit fe24be0

File tree

11 files changed

+20
-3
lines changed

11 files changed

+20
-3
lines changed

src/Profile/Shopware6/Converter/ProductConverter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Doctrine\DBAL\Connection;
1111
use Shopware\Core\Content\Product\ProductDefinition;
12-
use Shopware\Core\Content\Product\State;
1312
use Shopware\Core\Defaults;
1413
use Shopware\Core\Framework\Log\Package;
1514
use SwagMigrationAssistant\Migration\Converter\ConvertStruct;
@@ -269,7 +268,7 @@ private function convertStatesToType(array &$converted): void
269268
}
270269

271270
if (isset($converted['states']) && \is_array($converted['states'])) {
272-
$converted['type'] = \in_array(State::IS_DOWNLOAD, $converted['states'], true)
271+
$converted['type'] = \in_array('is-download', $converted['states'], true)
273272
? ProductDefinition::TYPE_DIGITAL
274273
: ProductDefinition::TYPE_PHYSICAL;
275274

tests/Profile/Shopware6/Converter/ProductConverterTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
namespace SwagMigrationAssistant\Test\Profile\Shopware6\Converter;
99

1010
use Doctrine\DBAL\Connection;
11+
use Doctrine\DBAL\Schema\AbstractSchemaManager;
12+
use Doctrine\DBAL\Schema\Column;
13+
use Doctrine\DBAL\Types\StringType;
1114
use Shopware\Core\Framework\Log\Package;
1215
use SwagMigrationAssistant\Migration\Converter\ConverterInterface;
1316
use SwagMigrationAssistant\Migration\DataSelection\DataSet\DataSet;
@@ -26,7 +29,13 @@ protected function createConverter(
2629
MediaFileServiceInterface $mediaFileService,
2730
?array $mappingArray = [],
2831
): ConverterInterface {
29-
$connection = static::getContainer()->get(Connection::class);
32+
$schemaManager = $this->createMock(AbstractSchemaManager::class);
33+
$schemaManager->method('listTableColumns')->willReturn([
34+
'type' => new Column('type', new StringType()),
35+
]);
36+
37+
$connection = $this->createMock(Connection::class);
38+
$connection->method('createSchemaManager')->willReturn($schemaManager);
3039

3140
return new ProductConverter($mappingService, $loggingService, $mediaFileService, $connection);
3241
}

tests/_fixtures/Shopware6/Product/01-HappyCaseContainer/output.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@
5656
'id' => 'd7e9ceac19a948abad07667419424b13',
5757
],
5858
],
59+
'type' => 'physical',
5960
];

tests/_fixtures/Shopware6/Product/02-HappyCaseVariant/output.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
'id' => 'bfaf0c7366e6454fb7516ab47435b01a',
2323
],
2424
],
25+
'type' => 'physical',
2526
];

tests/_fixtures/Shopware6/Product/03-MissingManufacturerMapping/output.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@
5555
'id' => 'd7e9ceac19a948abad07667419424b13',
5656
],
5757
],
58+
'type' => 'physical',
5859
];

tests/_fixtures/Shopware6/Product/04-StripUnmigrateableData/output.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@
5757
'id' => 'd7e9ceac19a948abad07667419424b13',
5858
],
5959
],
60+
'type' => 'physical',
6061
];

tests/_fixtures/Shopware6/Product/05-AdvancedPrices/output.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,5 @@
139139
],
140140
'coverId' => 'bdeb106f47ab4255b2bd5f35d84cae7c',
141141
'id' => 'fb2dbbee297c472c9e916b26952615ff',
142+
'type' => 'physical',
142143
];

tests/_fixtures/Shopware6/Product/06-DeliveryTimes/output.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,5 @@
140140
'coverId' => 'bdeb106f47ab4255b2bd5f35d84cae7c',
141141
'deliveryTimeId' => 'bdeb106f47ab4255b2bd5f35d84cae7c',
142142
'id' => 'fb2dbbee297c472c9e916b26952615ff',
143+
'type' => 'physical',
143144
];

tests/_fixtures/Shopware6/Product/07-Media/output.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@
8383
'coverId' => 'eb5483a9c77c4919b5d110e8d745a1cc',
8484
'deliveryTimeId' => 'bdeb106f47ab4255b2bd5f35d84cae7c',
8585
'id' => 'fb2dbbee297c472c9e916b26952615ff',
86+
'type' => 'physical',
8687
];

tests/_fixtures/Shopware6/Product/08-MigrateWithoutDefaultCurrency/output.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,5 @@
209209
'id' => 'd7e9ceac19a948abad07667419424b13',
210210
],
211211
],
212+
'type' => 'physical',
212213
];

0 commit comments

Comments
 (0)