Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Nov 29, 2024
1 parent 8c7fe79 commit 5196aad
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions php-packages/testing/tests/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions php-packages/testing/tests/tests/integration/TestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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, '');
Expand Down

0 comments on commit 5196aad

Please sign in to comment.