Skip to content

Commit

Permalink
fix adding solution with empty content
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 authored and trasher committed Aug 16, 2024
1 parent 693c903 commit c770dc0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/AbstractITILChildTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function getRenderedContent(CommonITILObject $itil_item): string
$content
);

if (!$html) {
if ($html === null) {
$html = $content;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ITILSolution.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function prepareInputForAdd($input)
);

// Invalid template
if (!$html) {
if ($html === null) {
return false;
}

Expand Down
21 changes: 21 additions & 0 deletions tests/functional/ITILSolution.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,25 @@ public function testTicketSolutionValidation()
$this->integer((int)$solution->fields['status'])->isIdenticalTo(\CommonITILValidation::ACCEPTED);
$this->integer((int)$ticket->fields['status'])->isIdenticalTo($ticket::CLOSED);
}

public function testAddEmptyContent()
{
$this->login();

$ticket = new Ticket();
$ticket_id = $ticket->add([
'name' => 'ticket title',
'description' => 'a description',
'content' => 'test',
]);
$this->integer($ticket_id)->isGreaterThan(0);

$solution = new \ITILSolution();
$solution_id = $solution->add([
'itemtype' => $ticket::getType(),
'items_id' => $ticket->getID(),
'content' => '',
]);
$this->integer($solution_id)->isGreaterThan(0);
}
}

0 comments on commit c770dc0

Please sign in to comment.