Skip to content

Commit 7b60535

Browse files
committed
Added TOP placement and test for bikini generation.
1 parent cd41e6f commit 7b60535

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/Structures/Placements.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ class Placements
8181
*/
8282
const TYPE_MOCKUP = 'mockup';
8383

84+
/**
85+
* Bikini top, backpack etc.
86+
*/
87+
const TYPE_TOP = 'top';
88+
8489
/**
8590
* @var array
8691
*/
@@ -137,6 +142,10 @@ class Placements
137142
'title' => 'Back waist',
138143
'conflictingTypes' => [],
139144
],
145+
self::TYPE_TOP => [
146+
'title' => 'Top',
147+
'conflictingTypes' => [],
148+
],
140149
];
141150

142151
/**

tests/MockupGenerator/MockupGenerationTest.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,24 @@ public function testGenerateEmbroideryApparelMockups()
279279
$mockups = $result->getVariantMockups(9114);
280280

281281
self::assertCount(1, $mockups, 'One on model mockup exists');
282-
self::assertCount(2, $mockups[0]->extraMockups, 'Two extra mockups exist (flat, wrinkled');
282+
self::assertCount(3, $mockups[0]->extraMockups, 'Two extra mockups exist (flat, wrinkled');
283+
}
284+
285+
public function testGenerateBikiniMockups()
286+
{
287+
$parameters = new MockupGenerationParameters;
288+
$parameters->productId = 273; // Two-piece bikini
289+
$parameters->variantIds = [
290+
9021,
291+
];
292+
293+
$parameters->addImageUrl(Placements::TYPE_TOP, 'https://dummyimage.com/1200x1200/f00/fff');
294+
$parameters->addImageUrl(Placements::TYPE_FRONT, 'https://dummyimage.com/1200x1200/0f0/fff');
295+
$parameters->addImageUrl(Placements::TYPE_BACK, 'https://dummyimage.com/1200x1200/00f/fff');
296+
297+
$result = $this->generator->createGenerationTaskAndWaitForResult($parameters)->mockupList;
298+
$mockups = $result->getVariantMockups(9021);
299+
300+
self::assertCount(3, $mockups, 'Top, front, back mockups exist');
283301
}
284302
}

0 commit comments

Comments
 (0)