From: Art4 Date: Thu, 15 May 2025 07:14:11 +0000 (+0000) Subject: Replace test addon with vfs files X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=075e9eaaa91dba197183ca47a0976634ab936123;p=friendica.git Replace test addon with vfs files --- diff --git a/tests/Unit/Core/Addon/AddonManagerHelperTest.php b/tests/Unit/Core/Addon/AddonManagerHelperTest.php index 41320361dd..9dbbbdfdd0 100644 --- a/tests/Unit/Core/Addon/AddonManagerHelperTest.php +++ b/tests/Unit/Core/Addon/AddonManagerHelperTest.php @@ -24,8 +24,22 @@ class AddonManagerHelperTest extends TestCase { public function testGetAddonInfoReturnsAddonInfo(): void { + $root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, [ + 'helloaddon' => [ + 'helloaddon.php' => << + */ + PHP, + ] + ]); + $addonManagerHelper = new AddonManagerHelper( - __DIR__ . '/../../../Util/addons', + $root->url(), $this->createStub(Database::class), $this->createStub(IManageConfigValues::class), $this->createStub(ICanCache::class), @@ -50,8 +64,10 @@ class AddonManagerHelperTest extends TestCase ], ]); + $root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, []); + $addonManagerHelper = new AddonManagerHelper( - __DIR__ . '/../../../Util/addons', + $root->url(), $this->createStub(Database::class), $config, $this->createStub(ICanCache::class), @@ -78,8 +94,10 @@ class AddonManagerHelperTest extends TestCase ], ]); + $root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, []); + $addonManagerHelper = new AddonManagerHelper( - __DIR__ . '/../../../Util/addons', + $root->url(), $this->createStub(Database::class), $config, $this->createStub(ICanCache::class), @@ -104,8 +122,10 @@ class AddonManagerHelperTest extends TestCase ], ]); + $root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, []); + $addonManagerHelper = new AddonManagerHelper( - __DIR__ . '/../../../Util/addons', + $root->url(), $this->createStub(Database::class), $config, $this->createStub(ICanCache::class), @@ -118,8 +138,14 @@ class AddonManagerHelperTest extends TestCase public function testGetAvailableAddons(): void { + $root = vfsStream::setup(__FUNCTION__ . '_addons', 0777, [ + 'helloaddon' => [ + 'helloaddon.php' => 'url(), $this->createStub(Database::class), $this->createStub(IManageConfigValues::class), $this->createStub(ICanCache::class), diff --git a/tests/Util/addons/helloaddon/helloaddon.php b/tests/Util/addons/helloaddon/helloaddon.php deleted file mode 100644 index 679298dfde..0000000000 --- a/tests/Util/addons/helloaddon/helloaddon.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ - -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 .= '

Hello, World!

'; -}