diff --git a/php-packages/testing/src/integration/Extension/ExtensionManagerIncludeCurrent.php b/php-packages/testing/src/integration/Extension/ExtensionManagerIncludeCurrent.php index 546899b8e2..7362d0bf71 100644 --- a/php-packages/testing/src/integration/Extension/ExtensionManagerIncludeCurrent.php +++ b/php-packages/testing/src/integration/Extension/ExtensionManagerIncludeCurrent.php @@ -12,6 +12,7 @@ use Flarum\Database\Migrator; use Flarum\Extension\Extension; use Flarum\Extension\ExtensionManager; +use Flarum\Foundation\Config; use Flarum\Foundation\MaintenanceMode; use Flarum\Foundation\Paths; use Flarum\Settings\SettingsRepositoryInterface; @@ -99,9 +100,13 @@ protected function setEnabledExtensions(array $enabledExtensions): void */ protected function getAssetsFilesystem(): Cloud { + /** @var Config $config */ + $config = $this->container->make(Config::class); $adapter = new LocalFilesystemAdapter($this->paths->public.'/assets'); - return new FilesystemAdapter(new \League\Flysystem\Filesystem($adapter), $adapter); + return new FilesystemAdapter(new \League\Flysystem\Filesystem($adapter), $adapter, [ + 'url' => $config->url().'/assets', + ]); } protected function includeCurrentExtension(Collection $extensions, $package, string $packagePath): Collection diff --git a/php-packages/testing/tests/composer.json b/php-packages/testing/tests/composer.json index c2085682b4..b0153e8fd3 100644 --- a/php-packages/testing/tests/composer.json +++ b/php-packages/testing/tests/composer.json @@ -13,6 +13,17 @@ "Flarum\\Testing\\Tests\\": "tests/" } }, + "extra": { + "flarum-extension": { + "title": "Testing", + "category": "feature", + "icon": { + "name": "fas fa-vial", + "backgroundColor": "#ABDC88", + "color": "#3F8A32" + } + } + }, "scripts": { "test": [ "@test:unit", diff --git a/php-packages/testing/tests/tests/integration/TestCaseTest.php b/php-packages/testing/tests/tests/integration/TestCaseTest.php index 7d41173fbc..95953a9c16 100644 --- a/php-packages/testing/tests/tests/integration/TestCaseTest.php +++ b/php-packages/testing/tests/tests/integration/TestCaseTest.php @@ -10,7 +10,9 @@ namespace Flarum\Testing\Tests\integration; use Flarum\Extend; +use Flarum\Extension\ExtensionManager; use Flarum\Foundation\Config; +use Flarum\Settings\DefaultSettingsRepository; use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Testing\integration\TestCase; use Flarum\User\User; @@ -45,15 +47,14 @@ public function can_add_settings_via_method() $this->assertEquals('something_other_than_username', $settings->get('display_name_driver')); } - /** - * Disabled failing test for now. - */ + #[Test] public function settings_cleaned_up_from_previous_method() { $settings = $this->app()->getContainer()->make(SettingsRepositoryInterface::class); + $defaults = $this->app()->getContainer()->make(DefaultSettingsRepository::class); $this->assertEquals(null, $settings->get('hello')); - $this->assertEquals(null, $settings->get('display_name_driver')); + $this->assertEquals($defaults->get('display_name_driver'), $settings->get('display_name_driver')); } #[Test] @@ -170,14 +171,13 @@ public function routes_added_by_current_extension_accessible() $this->assertEquals(200, $response->getStatusCode()); } - /** - * Disabled failing test for now. - */ + #[Test] public function extension_url_correct() { $this->extension('flarum-testing-tests'); $expected = $this->app()->getContainer()->make('filesystem')->disk('flarum-assets')->url('/flarum-testing-tests/'); // We need to test this since we override it. + /** @var ExtensionManager $extensions */ $extensions = $this->app()->getContainer()->make('flarum.extensions'); $currExtension = $extensions->getExtension('flarum-testing-tests'); $baseAssetsUrl = $extensions->getAsset($currExtension, '');