Skip to content

Commit

Permalink
fixup! fixup! IBX-7579:Richtext: Rows are added to ezurl_object_link …
Browse files Browse the repository at this point in the history
…on every save: Changed unit test into integration test
  • Loading branch information
vidarl committed Jun 19, 2024
1 parent 26e6145 commit c6c0c22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function insertUrl($url)
/**
* Return a list of URLs used by the given field and version.
*
* array<string, boolean> An array of URLs, with urls as keys
* string[] An array of URLs
*/
public function getUrlsFromUrlLink(int $fieldId, int $versionNo): array
{
Expand Down Expand Up @@ -163,12 +163,8 @@ public function getUrlsFromUrlLink(int $fieldId, int $versionNo): array

$statement = $selectQuery->execute();
$rows = $statement->fetchFirstColumn();
$result = [];
foreach ($rows as $url) {
$result[$url] = true;
}

return $result;
return $rows;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public function testGetUrlsFromUrlLink(): void
$gateway->linkUrl($urlIds[1], 12, 2);
$gateway->linkUrl($urlIds[2], 14, 1);

self::assertEquals(['https://ibexa.co/example1' => true, 'https://ibexa.co/example2' => true], $gateway->getUrlsFromUrlLink(10, 1), 'Did not get expected urlS for field 10');
self::assertEquals(['https://ibexa.co/example2' => true], $gateway->getUrlsFromUrlLink(12, 2), 'Did not get expected url for field 12');
self::assertEquals(['https://ibexa.co/example3' => true], $gateway->getUrlsFromUrlLink(14, 1), 'Did not get expected url for field 14');
self::assertEquals(['https://ibexa.co/example1', 'https://ibexa.co/example2'], $gateway->getUrlsFromUrlLink(10, 1), 'Did not get expected urls for field 10');
self::assertEquals(['https://ibexa.co/example2'], $gateway->getUrlsFromUrlLink(12, 2), 'Did not get expected url for field 12');
self::assertEquals(['https://ibexa.co/example3'], $gateway->getUrlsFromUrlLink(14, 1), 'Did not get expected url for field 14');
self::assertEquals([], $gateway->getUrlsFromUrlLink(15, 1), 'Expected no urls for field 15');
}

Expand Down

0 comments on commit c6c0c22

Please sign in to comment.