}
// 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);
}
'',
['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