Skip to content

Commit

Permalink
MOL-1294: force label to be empty string on null (#677)
Browse files Browse the repository at this point in the history
* MOL-1294: force label to be empty string on null

* MOL-1294: update test

---------

Co-authored-by: Vitalij Mik <[email protected]>
  • Loading branch information
BlackScorp and Vitalij Mik authored Jan 9, 2024
1 parent f411812 commit 37d176b
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 @@ -77,4 +77,15 @@ 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(): void
{
$refundItem = new RefundItemEntity();
$refundItem->label = null;

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

0 comments on commit 37d176b

Please sign in to comment.