From: Michael Date: Fri, 9 Jul 2021 17:13:54 +0000 (+0000) Subject: Fix the tests, hopefully X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e0fdde32878216e1c291386e7d3931ac0de5c807;p=friendica.git Fix the tests, hopefully --- diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 3fa8e74b48..0184861c3c 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1077,7 +1077,7 @@ class Contact if (!empty($contact)) { $contact_id = $contact["id"]; - if (empty($update)) { + if (empty($update) && (!empty($contact['uri-id']) || is_bool($update))) { Logger::debug('Contact found', ['url' => $url, 'uid' => $uid, 'update' => $update, 'cid' => $contact_id]); return $contact_id; } diff --git a/tests/datasets/api.fixture.php b/tests/datasets/api.fixture.php index fbf2aad47c..2c6512f8c6 100644 --- a/tests/datasets/api.fixture.php +++ b/tests/datasets/api.fixture.php @@ -71,10 +71,64 @@ return [ 'theme' => 'frio', ], ], + 'item-uri' => [ + [ + 'id' => 1, + 'uri' => '1', + 'guid' => '1', + ], + [ + 'id' => 2, + 'uri' => '2', + 'guid' => '2', + ], + [ + 'id' => 3, + 'uri' => '3', + 'guid' => '3', + ], + [ + 'id' => 4, + 'uri' => '4', + 'guid' => '4', + ], + [ + 'id' => 5, + 'uri' => '5', + 'guid' => '5', + ], + [ + 'id' => 6, + 'uri' => '6', + 'guid' => '6', + ], + + [ + 'id' => 42, + 'uri' => 'http://localhost/profile/selfcontact', + 'guid' => '42', + ], + [ + 'id' => 43, + 'uri' => 'http://localhost/profile/othercontact', + 'guid' => '43', + ], + [ + 'id' => 44, + 'uri' => 'http://localhost/profile/friendcontact', + 'guid' => '44', + ], + [ + 'id' => 46, + 'uri' => 'http://localhost/profile/mutualcontact', + 'guid' => '46', + ], + ], 'contact' => [ [ 'id' => 42, 'uid' => 42, + 'uri-id' => 42, 'name' => 'Self contact', 'nick' => 'selfcontact', 'self' => 1, @@ -92,6 +146,7 @@ return [ [ 'id' => 43, 'uid' => 0, + 'uri-id' => 43, 'name' => 'othercontact', 'nick' => 'othercontact', 'self' => 0, @@ -106,6 +161,7 @@ return [ [ 'id' => 44, 'uid' => 42, + 'uri-id' => 44, 'name' => 'Friend contact', 'nick' => 'friendcontact', 'self' => 0, @@ -120,6 +176,7 @@ return [ [ 'id' => 45, 'uid' => 0, + 'uri-id' => 44, 'name' => 'Friend contact', 'nick' => 'friendcontact', 'self' => 0, @@ -134,6 +191,7 @@ return [ [ 'id' => 46, 'uid' => 42, + 'uri-id' => 46, 'name' => 'Mutual contact', 'nick' => 'mutualcontact', 'self' => 0, @@ -148,6 +206,7 @@ return [ [ 'id' => 47, 'uid' => 0, + 'uri-id' => 46, 'name' => 'Mutual contact', 'nick' => 'mutualcontact', 'self' => 0, @@ -160,38 +219,6 @@ return [ 'location' => 'DFRN', ], ], - 'item-uri' => [ - [ - 'id' => 1, - 'uri' => '1', - 'guid' => '1', - ], - [ - 'id' => 2, - 'uri' => '2', - 'guid' => '2', - ], - [ - 'id' => 3, - 'uri' => '3', - 'guid' => '3', - ], - [ - 'id' => 4, - 'uri' => '4', - 'guid' => '4', - ], - [ - 'id' => 5, - 'uri' => '5', - 'guid' => '5', - ], - [ - 'id' => 6, - 'uri' => '6', - 'guid' => '6', - ], - ], 'verb' => [ [ 'id' => 0, diff --git a/tests/datasets/storage/database.fixture.php b/tests/datasets/storage/database.fixture.php index 6a73d4ed2a..9a8c675319 100644 --- a/tests/datasets/storage/database.fixture.php +++ b/tests/datasets/storage/database.fixture.php @@ -33,10 +33,18 @@ return [ 'theme' => 'frio', ], ], + 'item-uri' => [ + [ + 'id' => 42, + 'uri' => 'http://localhost/profile/selfcontact', + 'guid' => '42', + ], + ], 'contact' => [ [ 'id' => 42, 'uid' => 42, + 'uri-id' => 42, 'name' => 'Self contact', 'nick' => 'selfcontact', 'self' => 1,