mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 00:14:32 +02:00
Replace test addon with vfs files
This commit is contained in:
parent
367f7bd377
commit
075e9eaaa9
2 changed files with 31 additions and 34 deletions
|
@ -24,8 +24,22 @@ class AddonManagerHelperTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testGetAddonInfoReturnsAddonInfo(): void
|
public function testGetAddonInfoReturnsAddonInfo(): void
|
||||||
{
|
{
|
||||||
|
$root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, [
|
||||||
|
'helloaddon' => [
|
||||||
|
'helloaddon.php' => <<<PHP
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Name: Hello Addon
|
||||||
|
* Description: For testing purpose only
|
||||||
|
* Version: 1.0
|
||||||
|
* Author: Artur Weigandt <dont-mail-me@example.com>
|
||||||
|
*/
|
||||||
|
PHP,
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
$addonManagerHelper = new AddonManagerHelper(
|
$addonManagerHelper = new AddonManagerHelper(
|
||||||
__DIR__ . '/../../../Util/addons',
|
$root->url(),
|
||||||
$this->createStub(Database::class),
|
$this->createStub(Database::class),
|
||||||
$this->createStub(IManageConfigValues::class),
|
$this->createStub(IManageConfigValues::class),
|
||||||
$this->createStub(ICanCache::class),
|
$this->createStub(ICanCache::class),
|
||||||
|
@ -50,8 +64,10 @@ class AddonManagerHelperTest extends TestCase
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, []);
|
||||||
|
|
||||||
$addonManagerHelper = new AddonManagerHelper(
|
$addonManagerHelper = new AddonManagerHelper(
|
||||||
__DIR__ . '/../../../Util/addons',
|
$root->url(),
|
||||||
$this->createStub(Database::class),
|
$this->createStub(Database::class),
|
||||||
$config,
|
$config,
|
||||||
$this->createStub(ICanCache::class),
|
$this->createStub(ICanCache::class),
|
||||||
|
@ -78,8 +94,10 @@ class AddonManagerHelperTest extends TestCase
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, []);
|
||||||
|
|
||||||
$addonManagerHelper = new AddonManagerHelper(
|
$addonManagerHelper = new AddonManagerHelper(
|
||||||
__DIR__ . '/../../../Util/addons',
|
$root->url(),
|
||||||
$this->createStub(Database::class),
|
$this->createStub(Database::class),
|
||||||
$config,
|
$config,
|
||||||
$this->createStub(ICanCache::class),
|
$this->createStub(ICanCache::class),
|
||||||
|
@ -104,8 +122,10 @@ class AddonManagerHelperTest extends TestCase
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, []);
|
||||||
|
|
||||||
$addonManagerHelper = new AddonManagerHelper(
|
$addonManagerHelper = new AddonManagerHelper(
|
||||||
__DIR__ . '/../../../Util/addons',
|
$root->url(),
|
||||||
$this->createStub(Database::class),
|
$this->createStub(Database::class),
|
||||||
$config,
|
$config,
|
||||||
$this->createStub(ICanCache::class),
|
$this->createStub(ICanCache::class),
|
||||||
|
@ -118,8 +138,14 @@ class AddonManagerHelperTest extends TestCase
|
||||||
|
|
||||||
public function testGetAvailableAddons(): void
|
public function testGetAvailableAddons(): void
|
||||||
{
|
{
|
||||||
|
$root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, [
|
||||||
|
'helloaddon' => [
|
||||||
|
'helloaddon.php' => '<?php',
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
$addonManagerHelper = new AddonManagerHelper(
|
$addonManagerHelper = new AddonManagerHelper(
|
||||||
__DIR__ . '/../../../Util/addons',
|
$root->url(),
|
||||||
$this->createStub(Database::class),
|
$this->createStub(Database::class),
|
||||||
$this->createStub(IManageConfigValues::class),
|
$this->createStub(IManageConfigValues::class),
|
||||||
$this->createStub(ICanCache::class),
|
$this->createStub(ICanCache::class),
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name: Hello Addon
|
|
||||||
* Description: For testing purpose only
|
|
||||||
* Version: 1.0
|
|
||||||
* Author: Artur Weigandt <dont-mail-me@example.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Friendica\Core\Hook;
|
|
||||||
|
|
||||||
function helloaddon_install()
|
|
||||||
{
|
|
||||||
Hook::register('page_end', 'addon/helloaddon/helloaddon.php', 'helloaddon_page_end');
|
|
||||||
}
|
|
||||||
|
|
||||||
function helloaddon_uninstall()
|
|
||||||
{
|
|
||||||
Hook::unregister('page_end', 'addon/helloaddon/helloaddon.php', 'helloaddon_page_end');
|
|
||||||
}
|
|
||||||
|
|
||||||
function helloaddon_page_end(&$html)
|
|
||||||
{
|
|
||||||
$html .= '<p>Hello, World!</p>';
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue