Skip to content

Commit 42fd65d

Browse files
Refactor BmsFreeSendTest to improve image handling and add new test images
- Updated test methods to use specific image paths for wide (2:1 ratio) and square (1:1 ratio) images. - Added new helper method `getWideTestImagePath()` for retrieving wide test images. - Included new test images: example-1to1.jpg and example-2to1.jpg for enhanced testing coverage.
1 parent a7c184c commit 42fd65d

3 files changed

Lines changed: 34 additions & 8 deletions

File tree

tests/E2E/BmsFreeSendTest.php

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,13 @@ public function testSendBmsImage(): void
213213

214214
/**
215215
* Test sending BMS FREE WIDE type
216+
* Note: WIDE type requires 2:1 ratio image
216217
*/
217218
public function testSendBmsWide(): void
218219
{
219-
$imagePath = $this->getTestImagePath();
220+
$imagePath = $this->getWideTestImagePath();
220221
if (!$imagePath) {
221-
$this->markTestSkipped('Test image not found');
222+
$this->markTestSkipped('Wide test image (2:1 ratio) not found');
222223
}
223224

224225
try {
@@ -328,16 +329,21 @@ public function testSendBmsCommerce(): void
328329
*/
329330
public function testSendBmsWideItemList(): void
330331
{
331-
$imagePath = $this->getTestImagePath();
332-
if (!$imagePath) {
333-
$this->markTestSkipped('Test image not found');
332+
$mainImagePath = $this->getWideTestImagePath();
333+
$subImagePath = $this->getTestImagePath();
334+
335+
if (!$mainImagePath) {
336+
$this->markTestSkipped('Wide test image (2:1 ratio) not found for main item');
337+
}
338+
if (!$subImagePath) {
339+
$this->markTestSkipped('Square test image (1:1 ratio) not found for sub items');
334340
}
335341

336342
try {
337343
// Upload main image (2:1 ratio)
338-
$mainImageId = $this->messageService->uploadFile($imagePath, 'BMS_WIDE_ITEM_LIST_MAIN');
344+
$mainImageId = $this->messageService->uploadFile($mainImagePath, 'BMS_WIDE_ITEM_LIST_MAIN');
339345
// Upload sub images (1:1 ratio)
340-
$subImageId = $this->messageService->uploadFile($imagePath, 'BMS_WIDE_ITEM_LIST_SUB');
346+
$subImageId = $this->messageService->uploadFile($subImagePath, 'BMS_WIDE_ITEM_LIST_SUB');
341347

342348
$mainItem = new BmsMainWideItem();
343349
$mainItem->setImageId($mainImageId)
@@ -567,7 +573,7 @@ public function testSendBmsPremiumVideo(): void
567573
}
568574

569575
/**
570-
* Get test image path
576+
* Get test image path (1:1 ratio for IMAGE, COMMERCE, CAROUSEL types)
571577
*/
572578
private function getTestImagePath(): ?string
573579
{
@@ -576,6 +582,7 @@ private function getTestImagePath(): ?string
576582
}
577583

578584
$possiblePaths = [
585+
__DIR__ . '/../assets/example-1to1.jpg',
579586
__DIR__ . '/../../examples/images/example_square.jpg',
580587
__DIR__ . '/../../examples/images/example_wide.jpg',
581588
__DIR__ . '/../fixtures/test_image.jpg',
@@ -589,4 +596,23 @@ private function getTestImagePath(): ?string
589596

590597
return null;
591598
}
599+
600+
/**
601+
* Get wide test image path (2:1 ratio for WIDE, WIDE_ITEM_LIST main types)
602+
*/
603+
private function getWideTestImagePath(): ?string
604+
{
605+
$possiblePaths = [
606+
__DIR__ . '/../assets/example-2to1.jpg',
607+
__DIR__ . '/../../examples/images/example_wide.jpg',
608+
];
609+
610+
foreach ($possiblePaths as $path) {
611+
if (file_exists($path)) {
612+
return $path;
613+
}
614+
}
615+
616+
return null;
617+
}
592618
}

tests/assets/example-1to1.jpg

36.6 KB
Loading

tests/assets/example-2to1.jpg

45.4 KB
Loading

0 commit comments

Comments
 (0)