mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 07:44:27 +02:00
Fix warning if author or maintainer is missing in addon info
This commit is contained in:
parent
d88119139f
commit
6a058793f0
2 changed files with 57 additions and 4 deletions
|
@ -74,12 +74,16 @@ final class AddonInfo
|
|||
}
|
||||
|
||||
// rename author to authors
|
||||
$data['authors'] = $data['author'];
|
||||
unset($data['author']);
|
||||
if (array_key_exists('author', $data)) {
|
||||
$data['authors'] = $data['author'];
|
||||
unset($data['author']);
|
||||
}
|
||||
|
||||
// rename maintainer to maintainers
|
||||
$data['maintainers'] = $data['maintainer'];
|
||||
unset($data['maintainer']);
|
||||
if (array_key_exists('maintainer', $data)) {
|
||||
$data['maintainers'] = $data['maintainer'];
|
||||
unset($data['maintainer']);
|
||||
}
|
||||
|
||||
return self::fromArray($data);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,55 @@ class AddonInfoTest extends TestCase
|
|||
'',
|
||||
['id' => 'test'],
|
||||
],
|
||||
'without-author' => [
|
||||
'test',
|
||||
<<<TEXT
|
||||
<?php
|
||||
/*
|
||||
* Name: Test Addon
|
||||
* Description: adds awesome features to friendica
|
||||
* Version: 100.4.50-beta.5
|
||||
* Maintainer: Robin
|
||||
* Status: beta
|
||||
* Ignore: The "ignore" key is unsupported and will be ignored
|
||||
*/
|
||||
TEXT,
|
||||
[
|
||||
'id' => 'test',
|
||||
'name' => 'Test Addon',
|
||||
'description' => 'adds awesome features to friendica',
|
||||
|
||||
'maintainers' => [
|
||||
['name' => 'Robin'],
|
||||
],
|
||||
'version' => '100.4.50-beta.5',
|
||||
'status' => 'beta',
|
||||
],
|
||||
],
|
||||
'without-maintainer' => [
|
||||
'test',
|
||||
<<<TEXT
|
||||
<?php
|
||||
/*
|
||||
* Name: Test Addon
|
||||
* Description: adds awesome features to friendica
|
||||
* Version: 100.4.50-beta.5
|
||||
* Author: Sam
|
||||
* Status: beta
|
||||
* Ignore: The "ignore" key is unsupported and will be ignored
|
||||
*/
|
||||
TEXT,
|
||||
[
|
||||
'id' => 'test',
|
||||
'name' => 'Test Addon',
|
||||
'description' => 'adds awesome features to friendica',
|
||||
'authors' => [
|
||||
['name' => 'Sam'],
|
||||
],
|
||||
'version' => '100.4.50-beta.5',
|
||||
'status' => 'beta',
|
||||
],
|
||||
],
|
||||
'complete' => [
|
||||
'test',
|
||||
<<<TEXT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue