Skip to content

Commit

Permalink
MOL-1294: force label to be empty string on null
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalij Mik committed Jan 9, 2024
1 parent f411812 commit 9950bc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function setRefund(?RefundEntity $refund): void
*/
public function getLabel(): string
{
return $this->label;
return (string) $this->label;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,16 @@ public function testDALPayloadNoRefundIfEmpty(): void

$this->assertArrayNotHasKey('refundId', $payload);
}

/**
* This test verifies that no errors is thrown if the label have a null value from the database
* @return void
*/
public function testLabelHaveEmptyValueOnNUll()
{
$refundItem = new RefundItemEntity();
$refundItem->label = null;

$this->assertSame('',$refundItem->getLabel());
}
}

0 comments on commit 9950bc7

Please sign in to comment.