From 74a83d570d334a7b9ee09d1c7d42dded6f99a118 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 6 Oct 2024 20:08:48 +0200 Subject: [PATCH] fix(tests): Always add title and description to bookmarks providers Signed-off-by: Marcel Klehr --- tests/BackgroundJobTest.php | 10 +++++----- tests/BookmarkMapperTest.php | 8 ++++---- tests/FindTest.php | 6 +++--- tests/HtmlImportExportTest.php | 8 ++++---- tests/TagMapperTest.php | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/BackgroundJobTest.php b/tests/BackgroundJobTest.php index 9b36aefb6c..056c90e612 100644 --- a/tests/BackgroundJobTest.php +++ b/tests/BackgroundJobTest.php @@ -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' => ''], + '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' => ''], ]); } } diff --git a/tests/BookmarkMapperTest.php b/tests/BookmarkMapperTest.php index bfb85b274a..21ee59daa4 100644 --- a/tests/BookmarkMapperTest.php +++ b/tests/BookmarkMapperTest.php @@ -130,13 +130,13 @@ public function testDelete(Entity $bookmark) { * @return array */ public function singleBookmarksProvider(): array { - return array_map(static function ($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' => ''], ]); } } diff --git a/tests/FindTest.php b/tests/FindTest.php index 08356ac6ef..deb77cf637 100644 --- a/tests/FindTest.php +++ b/tests/FindTest.php @@ -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' => '']], ]); } } diff --git a/tests/HtmlImportExportTest.php b/tests/HtmlImportExportTest.php index 0ee4e10b09..a011307a61 100644 --- a/tests/HtmlImportExportTest.php +++ b/tests/HtmlImportExportTest.php @@ -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' => ''], ]), ]; } diff --git a/tests/TagMapperTest.php b/tests/TagMapperTest.php index 84143e9db3..173510cb14 100644 --- a/tests/TagMapperTest.php +++ b/tests/TagMapperTest.php @@ -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' => '']], ]); } }