mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-11 00:24:27 +02:00
Merge branch 'rework-addon-class' into deprecate-addonloader
This commit is contained in:
commit
4bac217806
38 changed files with 1687 additions and 1244 deletions
|
@ -13,6 +13,7 @@ use Exception;
|
|||
use Friendica\Core\Addon\AddonInfo;
|
||||
use Friendica\Core\Addon\AddonManagerHelper;
|
||||
use Friendica\Core\Addon\Exception\AddonInvalidConfigFileException;
|
||||
use Friendica\Core\Addon\Exception\InvalidAddonException;
|
||||
use Friendica\Core\Cache\Capability\ICanCache;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Database\Database;
|
||||
|
@ -55,6 +56,32 @@ class AddonManagerHelperTest extends TestCase
|
|||
$this->assertEquals('Hello Addon', $info->getName());
|
||||
}
|
||||
|
||||
public function testGetAddonInfoThrowsInvalidAddonException(): void
|
||||
{
|
||||
$root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, [
|
||||
'helloaddon' => [
|
||||
'helloaddon.php' => <<<PHP
|
||||
<?php
|
||||
// This is not a valid addon comment section
|
||||
PHP,
|
||||
]
|
||||
]);
|
||||
|
||||
$addonManagerHelper = new AddonManagerHelper(
|
||||
$root->url(),
|
||||
$this->createStub(Database::class),
|
||||
$this->createStub(IManageConfigValues::class),
|
||||
$this->createStub(ICanCache::class),
|
||||
$this->createStub(LoggerInterface::class),
|
||||
$this->createStub(Profiler::class)
|
||||
);
|
||||
|
||||
$this->expectException(InvalidAddonException::class);
|
||||
$this->expectExceptionMessage('Could not find valid comment block in addon file:');
|
||||
|
||||
$addonManagerHelper->getAddonInfo('helloaddon');
|
||||
}
|
||||
|
||||
public function testGetAddonDependencyConfigReturnsArray(): void
|
||||
{
|
||||
$root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, [
|
||||
|
@ -211,7 +238,18 @@ class AddonManagerHelperTest extends TestCase
|
|||
{
|
||||
$root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, [
|
||||
'helloaddon' => [
|
||||
'helloaddon.php' => '<?php',
|
||||
'helloaddon.php' => <<<PHP
|
||||
<?php
|
||||
/**
|
||||
* Name: Hello Addon
|
||||
* Description: For testing purpose only
|
||||
* Version: 1.0
|
||||
* Author: Artur Weigandt <dont-mail-me@example.com>
|
||||
*/
|
||||
PHP,
|
||||
],
|
||||
'invalidaddon' => [
|
||||
'invalidaddon.php' => 'This addon should not be loaded, because it does not contain a valid comment section.',
|
||||
],
|
||||
'.hidden' => [
|
||||
'.hidden.php' => 'This folder should be ignored',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue