Skip to content

Commit

Permalink
fix(tests): Always add title and description to bookmarks providers
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Oct 6, 2024
1 parent 76f6d95 commit 538d8c1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
10 changes: 5 additions & 5 deletions tests/BackgroundJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ public function testGCJob() : void {
*/
public function singleBookmarksProvider() {
return array_map(function ($props) {
return Bookmark::fromArray($props + ['userId' => 'test']);
return Bookmark::fromArray(array_merge($props, ['userId' => 'test']));
}, [
'Simple URL with title and description' => ['url' => 'https://google.com/', 'title' => 'Google', 'description' => 'Search engine'],
'Simple URL with title' => ['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud'],
'Simple URL' => ['url' => 'https://php.net/'],
'URL with unicode' => ['url' => 'https://de.wikipedia.org/wiki/%C3%9C'],
'Non-existent URL' => ['url' => 'https://http://www.bllaala.com/'],
'Simple URL with title' => ['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud', 'description' => 'nextcloud'],
'Simple URL' => ['url' => 'https://php.net/', 'title' => 'PHP', 'description' => 'php'],
'URL with unicode' => ['url' => 'https://de.wikipedia.org/wiki/%C3%9C', 'title' => 'Url with unicode', 'description' => 'wikipedia'],
'Non-existent URL' => ['url' => 'https://http://www.bllaala.com/', 'title' => 'Non-existent', 'description' => 'non-existent'],
]);
}
}
11 changes: 6 additions & 5 deletions tests/BookmarkMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ public function testDelete(Entity $bookmark) {
* @return array
*/
public function singleBookmarksProvider(): array {
return array_map(static function ($props) {
return [Db\Bookmark::fromArray($props)];
return array_map(function ($props) {
return Db\Bookmark::fromArray($props);
}, [
'Simple URL with title and description' => ['url' => 'https://google.com/', 'title' => 'Google', 'description' => 'Search engine'],
'Simple URL with title' => ['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud'],
'Simple URL' => ['url' => 'https://php.net/'],
'URL with unicode' => ['url' => 'https://de.wikipedia.org/wiki/%C3%9C'],
'Simple URL with title' => ['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud', 'description' => ''],
'Simple URL' => ['url' => 'https://php.net/', 'title' => '', 'description' => ''],
'URL with unicode' => ['url' => 'https://de.wikipedia.org/wiki/%C3%9C', 'title' => '', 'description' => ''],
'Non-existent URL' => ['url' => 'https://http://www.bllaala.com/', 'title' => '', 'description' => ''],
]);
}
}
6 changes: 3 additions & 3 deletions tests/FindTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ public function singleBookmarksProvider() {
return [$data[0], Db\Bookmark::fromArray($data[1])];
}, [
[['one'], ['url' => 'https://google.com/', 'title' => 'Google', 'description' => 'Search engine']],
[['two'], ['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud']],
[['three', 'one'], ['url' => 'https://php.net/']],
[['two', 'four', 'one'], ['url' => 'https://de.wikipedia.org/wiki/%C3%9C']],
[['two'], ['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud', 'description' => '']],
[['three', 'one'], ['url' => 'https://php.net/', 'title' => '', 'description' => '']],
[['two', 'four', 'one'], ['url' => 'https://de.wikipedia.org/wiki/%C3%9C', 'title' => '', 'description' => '']],
]);
}
}
8 changes: 4 additions & 4 deletions tests/HtmlImportExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ public function exportProvider(): array {
return Db\Bookmark::fromArray($props);
}, [
['url' => 'https://google.com/', 'title' => 'Google', 'description' => 'Search engine'],
['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud'],
['url' => 'https://php.net/'],
['url' => 'https://de.wikipedia.org/wiki/%C3%9C'],
['url' => 'https://github.com/nextcloud/bookmarks/projects/1'],
['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud', 'description' => ''],
['url' => 'https://php.net/', 'title' => '', 'description' => ''],
['url' => 'https://de.wikipedia.org/wiki/%C3%9C', 'title' => '', 'description' => ''],
['url' => 'https://github.com/nextcloud/bookmarks/projects/1', 'title' => '', 'description' => ''],
]),
];
}
Expand Down
6 changes: 3 additions & 3 deletions tests/TagMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public function singleBookmarksProvider() {
return [$data[0], Db\Bookmark::fromArray($data[1])];
}, [
[['one'], ['url' => 'https://google.com/', 'title' => 'Google', 'description' => 'Search engine']],
[['two'], ['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud']],
[['three', 'one'], ['url' => 'https://php.net/']],
[['two', 'four', 'one'], ['url' => 'https://de.wikipedia.org/wiki/%C3%9C']],
[['two'], ['url' => 'https://nextcloud.com/', 'title' => 'Nextcloud', 'description' => '']],
[['three', 'one'], ['url' => 'https://php.net/', 'title' => '', 'description' => '']],
[['two', 'four', 'one'], ['url' => 'https://de.wikipedia.org/wiki/%C3%9C', 'title' => '', 'description' => '']],
]);
}
}

0 comments on commit 538d8c1

Please sign in to comment.