Skip to content

Commit 31a3dc7

Browse files
committed
Minor fixes
1 parent 0c0483f commit 31a3dc7

File tree

4 files changed

+61
-59
lines changed

4 files changed

+61
-59
lines changed

config/config/grid/process_import.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ sylius_grid:
3131
type: show
3232
delete:
3333
type: delete
34-
options:
35-
enabled: "resource.status in ['success', 'failed', 'cancelled']"
3634
bulk:
3735
delete:
3836
type: delete
39-
options:
40-
enabled: "resource.status in ['success', 'failed', 'cancelled']"

src/Messenger/Handler/ImportCommandHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ public function __invoke(ImportCommand $command): void
7575
if ($process->getBatchesCount() <= 0) {
7676
$process->setStatus('success');
7777
}
78+
79+
$this->entityManager->flush();
7880
} catch (\Throwable $e) {
7981
$process->setStatus('failed');
8082
$process->setErrorMessage($e->getMessage());
83+
$this->entityManager->flush();
8184
}
8285
}
8386
}

tests/Functional/Importing/ImportHandlerTest.php

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -248,80 +248,80 @@ public static function getImportData(): array
248248
{
249249
return [
250250
'single basic dummy' => [
251-
'importData' => [
252251
[
253-
'uuid' => 'basic-uuid-1',
254-
'text' => 'Basic Text',
255-
'counter' => 10,
256-
'config' => ['enabled' => false],
252+
[
253+
'uuid' => 'basic-uuid-1',
254+
'text' => 'Basic Text',
255+
'counter' => 10,
256+
'config' => ['enabled' => false],
257+
],
257258
],
258-
],
259-
'expectedCount' => 1,
259+
1,
260260
],
261261
'multiple basic dummies' => [
262-
'importData' => [
263-
[
264-
'uuid' => 'multi-uuid-1',
265-
'text' => 'Multi Text 1',
266-
'counter' => 20,
267-
'config' => ['priority' => 'high'],
268-
],
269262
[
270-
'uuid' => 'multi-uuid-2',
271-
'text' => 'Multi Text 2',
272-
'counter' => 30,
273-
'config' => ['priority' => 'low'],
263+
[
264+
'uuid' => 'multi-uuid-1',
265+
'text' => 'Multi Text 1',
266+
'counter' => 20,
267+
'config' => ['priority' => 'high'],
268+
],
269+
[
270+
'uuid' => 'multi-uuid-2',
271+
'text' => 'Multi Text 2',
272+
'counter' => 30,
273+
'config' => ['priority' => 'low'],
274+
],
274275
],
275-
],
276-
'expectedCount' => 2,
276+
2,
277277
],
278278
'complex nested config dummies' => [
279-
'importData' => [
280279
[
281-
'uuid' => 'complex-uuid-1',
282-
'text' => 'Complex Text 1',
283-
'counter' => 100,
284-
'config' => [
285-
'enabled' => true,
286-
'metadata' => [
287-
'tags' => ['important', 'urgent'],
288-
'created_by' => 'system',
280+
[
281+
'uuid' => 'complex-uuid-1',
282+
'text' => 'Complex Text 1',
283+
'counter' => 100,
284+
'config' => [
285+
'enabled' => true,
286+
'metadata' => [
287+
'tags' => ['important', 'urgent'],
288+
'created_by' => 'system',
289+
],
289290
],
290291
],
291-
],
292-
[
293-
'uuid' => 'complex-uuid-2',
294-
'text' => 'Complex Text 2',
295-
'counter' => 200,
296-
'config' => [
297-
'enabled' => false,
298-
'settings' => [
299-
'auto_process' => true,
300-
'retry_count' => 3,
292+
[
293+
'uuid' => 'complex-uuid-2',
294+
'text' => 'Complex Text 2',
295+
'counter' => 200,
296+
'config' => [
297+
'enabled' => false,
298+
'settings' => [
299+
'auto_process' => true,
300+
'retry_count' => 3,
301+
],
301302
],
302303
],
303304
],
304-
],
305-
'expectedCount' => 2,
305+
2,
306306
],
307307
'edge case values' => [
308-
'importData' => [
309-
[
310-
'uuid' => 'edge-uuid-1',
311-
'text' => '',
312-
'counter' => 0,
313-
'config' => [],
314-
],
315308
[
316-
'uuid' => 'edge-uuid-2',
317-
'text' => 'Simple edge case text',
318-
'counter' => 999999,
319-
'config' => [
320-
'special_chars' => '!@#$%^&*()_+-={}|[]\\:";\'<>?,./',
309+
[
310+
'uuid' => 'edge-uuid-1',
311+
'text' => 'Valid text',
312+
'counter' => 0,
313+
'config' => [],
314+
],
315+
[
316+
'uuid' => 'edge-uuid-2',
317+
'text' => 'Simple edge case text',
318+
'counter' => 999999,
319+
'config' => [
320+
'special_chars' => '!@#$%^&*()_+-={}|[]\\:";\'<>?,./',
321+
],
321322
],
322323
],
323-
],
324-
'expectedCount' => 2,
324+
2,
325325
],
326326
];
327327
}

tests/TestApplication/src/Entity/Dummy.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Sylius\ImportExport\Serializer\DefaultSerializationGroups;
2121
use Sylius\Resource\Model\ResourceInterface;
2222
use Symfony\Component\Serializer\Attribute\Groups;
23+
use Symfony\Component\Validator\Constraints as Assert;
2324

2425
#[Entity]
2526
#[ORM\Table(name: 'sylius_test_dummy')]
@@ -33,10 +34,12 @@ class Dummy implements ResourceInterface
3334

3435
#[ORM\Column(name: 'text')]
3536
#[Groups(DefaultSerializationGroups::EXPORT_GROUP)]
37+
#[Assert\NotBlank]
3638
private string $text;
3739

3840
#[ORM\Column(name: 'counter', type: 'integer')]
3941
#[Groups(DefaultSerializationGroups::EXPORT_GROUP)]
42+
#[Assert\PositiveOrZero]
4043
private int $counter;
4144

4245
#[ORM\Column(name: 'config', type: 'json')]

0 commit comments

Comments
 (0)