Fix the tests, hopefully

This commit is contained in:
Michael 2021-07-09 17:13:54 +00:00
parent 04580ad4fb
commit e0fdde3287
3 changed files with 125 additions and 90 deletions

View File

@ -1077,7 +1077,7 @@ class Contact
if (!empty($contact)) { if (!empty($contact)) {
$contact_id = $contact["id"]; $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]); Logger::debug('Contact found', ['url' => $url, 'uid' => $uid, 'update' => $update, 'cid' => $contact_id]);
return $contact_id; return $contact_id;
} }

View File

@ -71,95 +71,6 @@ return [
'theme' => 'frio', 'theme' => 'frio',
], ],
], ],
'contact' => [
[
'id' => 42,
'uid' => 42,
'name' => 'Self contact',
'nick' => 'selfcontact',
'self' => 1,
'nurl' => 'http://localhost/profile/selfcontact',
'url' => 'http://localhost/profile/selfcontact',
'about' => 'User used in tests',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::FOLLOWER,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
// Having the same name and nick allows us to test
// the fallback to api_get_nick() in api_get_user()
[
'id' => 43,
'uid' => 0,
'name' => 'othercontact',
'nick' => 'othercontact',
'self' => 0,
'nurl' => 'http://localhost/profile/othercontact',
'url' => 'http://localhost/profile/othercontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::NOTHING,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
[
'id' => 44,
'uid' => 42,
'name' => 'Friend contact',
'nick' => 'friendcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/friendcontact',
'url' => 'http://localhost/profile/friendcontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
[
'id' => 45,
'uid' => 0,
'name' => 'Friend contact',
'nick' => 'friendcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/friendcontact',
'url' => 'http://localhost/profile/friendcontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
[
'id' => 46,
'uid' => 42,
'name' => 'Mutual contact',
'nick' => 'mutualcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/mutualcontact',
'url' => 'http://localhost/profile/mutualcontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::FRIEND,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
[
'id' => 47,
'uid' => 0,
'name' => 'Mutual contact',
'nick' => 'mutualcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/mutualcontact',
'url' => 'http://localhost/profile/mutualcontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
],
'item-uri' => [ 'item-uri' => [
[ [
'id' => 1, 'id' => 1,
@ -191,6 +102,122 @@ return [
'uri' => '6', 'uri' => '6',
'guid' => '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,
'nurl' => 'http://localhost/profile/selfcontact',
'url' => 'http://localhost/profile/selfcontact',
'about' => 'User used in tests',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::FOLLOWER,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
// Having the same name and nick allows us to test
// the fallback to api_get_nick() in api_get_user()
[
'id' => 43,
'uid' => 0,
'uri-id' => 43,
'name' => 'othercontact',
'nick' => 'othercontact',
'self' => 0,
'nurl' => 'http://localhost/profile/othercontact',
'url' => 'http://localhost/profile/othercontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::NOTHING,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
[
'id' => 44,
'uid' => 42,
'uri-id' => 44,
'name' => 'Friend contact',
'nick' => 'friendcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/friendcontact',
'url' => 'http://localhost/profile/friendcontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
[
'id' => 45,
'uid' => 0,
'uri-id' => 44,
'name' => 'Friend contact',
'nick' => 'friendcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/friendcontact',
'url' => 'http://localhost/profile/friendcontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
[
'id' => 46,
'uid' => 42,
'uri-id' => 46,
'name' => 'Mutual contact',
'nick' => 'mutualcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/mutualcontact',
'url' => 'http://localhost/profile/mutualcontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::FRIEND,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
[
'id' => 47,
'uid' => 0,
'uri-id' => 46,
'name' => 'Mutual contact',
'nick' => 'mutualcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/mutualcontact',
'url' => 'http://localhost/profile/mutualcontact',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
], ],
'verb' => [ 'verb' => [
[ [

View File

@ -33,10 +33,18 @@ return [
'theme' => 'frio', 'theme' => 'frio',
], ],
], ],
'item-uri' => [
[
'id' => 42,
'uri' => 'http://localhost/profile/selfcontact',
'guid' => '42',
],
],
'contact' => [ 'contact' => [
[ [
'id' => 42, 'id' => 42,
'uid' => 42, 'uid' => 42,
'uri-id' => 42,
'name' => 'Self contact', 'name' => 'Self contact',
'nick' => 'selfcontact', 'nick' => 'selfcontact',
'self' => 1, 'self' => 1,