mirror of
https://github.com/flarum/framework.git
synced 2024-11-22 09:24:01 +08:00
Apply fixes from StyleCI
This commit is contained in:
parent
74ce4cf1a7
commit
5399c86a1b
|
@ -47,7 +47,7 @@ class Akismet
|
|||
$client = new Client();
|
||||
|
||||
return $client->request('POST', "$this->apiUrl/$type", [
|
||||
'headers' => [
|
||||
'headers' => [
|
||||
'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion",
|
||||
],
|
||||
'form_params' => $this->params,
|
||||
|
|
|
@ -32,6 +32,7 @@ class AddCanFlagAttribute
|
|||
// If $actor is the post author, check to see if the setting is enabled
|
||||
return (bool) $this->settings->get('flarum-flags.can_flag_own');
|
||||
}
|
||||
|
||||
// $actor is not the post author
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ class FlagSerializer extends AbstractSerializer
|
|||
}
|
||||
|
||||
return [
|
||||
'type' => $model->type,
|
||||
'reason' => $model->reason,
|
||||
'type' => $model->type,
|
||||
'reason' => $model->reason,
|
||||
'reasonDetail' => $model->reason_detail,
|
||||
'createdAt' => $this->formatDate($model->created_at),
|
||||
'createdAt' => $this->formatDate($model->created_at),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -34,19 +34,19 @@ class TagSerializer extends AbstractSerializer
|
|||
}
|
||||
|
||||
$attributes = [
|
||||
'name' => $model->name,
|
||||
'description' => $model->description,
|
||||
'slug' => $this->slugManager->forResource(Tag::class)->toSlug($model),
|
||||
'color' => $model->color,
|
||||
'backgroundUrl' => $model->background_path,
|
||||
'backgroundMode' => $model->background_mode,
|
||||
'icon' => $model->icon,
|
||||
'discussionCount' => (int) $model->discussion_count,
|
||||
'position' => $model->position === null ? null : (int) $model->position,
|
||||
'defaultSort' => $model->default_sort,
|
||||
'isChild' => (bool) $model->parent_id,
|
||||
'isHidden' => (bool) $model->is_hidden,
|
||||
'lastPostedAt' => $this->formatDate($model->last_posted_at),
|
||||
'name' => $model->name,
|
||||
'description' => $model->description,
|
||||
'slug' => $this->slugManager->forResource(Tag::class)->toSlug($model),
|
||||
'color' => $model->color,
|
||||
'backgroundUrl' => $model->background_path,
|
||||
'backgroundMode' => $model->background_mode,
|
||||
'icon' => $model->icon,
|
||||
'discussionCount' => (int) $model->discussion_count,
|
||||
'position' => $model->position === null ? null : (int) $model->position,
|
||||
'defaultSort' => $model->default_sort,
|
||||
'isChild' => (bool) $model->parent_id,
|
||||
'isHidden' => (bool) $model->is_hidden,
|
||||
'lastPostedAt' => $this->formatDate($model->last_posted_at),
|
||||
'canStartDiscussion' => $this->actor->can('startDiscussion', $model),
|
||||
'canAddToDiscussion' => $this->actor->can('addToDiscussion', $model)
|
||||
];
|
||||
|
|
|
@ -27,7 +27,7 @@ trait RetrievesRepresentativeTags
|
|||
['id' => 11, 'name' => 'Secondary Restricted', 'slug' => 'secondary-restricted', 'position' => null, 'parent_id' => null, 'is_restricted' => true],
|
||||
['id' => 12, 'name' => 'Primary Restricted 2', 'slug' => 'primary-2-restricted', 'position' => 100, 'parent_id' => null, 'is_restricted' => true],
|
||||
['id' => 13, 'name' => 'Primary Restricted 2 Child 1', 'slug' => 'primary-2-restricted-child-1', 'position' => 101, 'parent_id' => 12],
|
||||
['id' => 14, 'name' => 'Primary Restricted 3', 'slug' => 'primary-3-restricted', 'position' => 102, 'parent_id' =>null, 'is_restricted' => true],
|
||||
['id' => 14, 'name' => 'Primary Restricted 3', 'slug' => 'primary-3-restricted', 'position' => 102, 'parent_id' => null, 'is_restricted' => true],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class BasicDiscussionSerializer extends AbstractSerializer
|
|||
|
||||
return [
|
||||
'title' => $model->title,
|
||||
'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($model),
|
||||
'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($model),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ class BasicPostSerializer extends AbstractSerializer
|
|||
}
|
||||
|
||||
$attributes = [
|
||||
'number' => (int) $model->number,
|
||||
'createdAt' => $this->formatDate($model->created_at),
|
||||
'number' => (int) $model->number,
|
||||
'createdAt' => $this->formatDate($model->created_at),
|
||||
'contentType' => $model->type
|
||||
];
|
||||
|
||||
|
|
|
@ -35,10 +35,10 @@ class BasicUserSerializer extends AbstractSerializer
|
|||
}
|
||||
|
||||
return [
|
||||
'username' => $model->username,
|
||||
'username' => $model->username,
|
||||
'displayName' => $model->display_name,
|
||||
'avatarUrl' => $model->avatar_url,
|
||||
'slug' => $this->slugManager->forResource(User::class)->toSlug($model)
|
||||
'avatarUrl' => $model->avatar_url,
|
||||
'slug' => $this->slugManager->forResource(User::class)->toSlug($model)
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@ class CurrentUserSerializer extends UserSerializer
|
|||
$attributes = parent::getDefaultAttributes($model);
|
||||
|
||||
$attributes += [
|
||||
'isEmailConfirmed' => (bool) $model->is_email_confirmed,
|
||||
'email' => $model->email,
|
||||
'markedAllAsReadAt' => $this->formatDate($model->marked_all_as_read_at),
|
||||
'unreadNotificationCount' => (int) $model->getUnreadNotificationCount(),
|
||||
'newNotificationCount' => (int) $model->getNewNotificationCount(),
|
||||
'preferences' => (array) $model->preferences,
|
||||
'isAdmin' => $model->isAdmin(),
|
||||
'isEmailConfirmed' => (bool) $model->is_email_confirmed,
|
||||
'email' => $model->email,
|
||||
'markedAllAsReadAt' => $this->formatDate($model->marked_all_as_read_at),
|
||||
'unreadNotificationCount' => (int) $model->getUnreadNotificationCount(),
|
||||
'newNotificationCount' => (int) $model->getNewNotificationCount(),
|
||||
'preferences' => (array) $model->preferences,
|
||||
'isAdmin' => $model->isAdmin(),
|
||||
];
|
||||
|
||||
return $attributes;
|
||||
|
|
|
@ -19,15 +19,15 @@ class DiscussionSerializer extends BasicDiscussionSerializer
|
|||
protected function getDefaultAttributes(object|array $model): array
|
||||
{
|
||||
$attributes = parent::getDefaultAttributes($model) + [
|
||||
'commentCount' => (int) $model->comment_count,
|
||||
'participantCount' => (int) $model->participant_count,
|
||||
'createdAt' => $this->formatDate($model->created_at),
|
||||
'lastPostedAt' => $this->formatDate($model->last_posted_at),
|
||||
'lastPostNumber' => (int) $model->last_post_number,
|
||||
'canReply' => $this->actor->can('reply', $model),
|
||||
'canRename' => $this->actor->can('rename', $model),
|
||||
'canDelete' => $this->actor->can('delete', $model),
|
||||
'canHide' => $this->actor->can('hide', $model)
|
||||
'commentCount' => (int) $model->comment_count,
|
||||
'participantCount' => (int) $model->participant_count,
|
||||
'createdAt' => $this->formatDate($model->created_at),
|
||||
'lastPostedAt' => $this->formatDate($model->last_posted_at),
|
||||
'lastPostNumber' => (int) $model->last_post_number,
|
||||
'canReply' => $this->actor->can('reply', $model),
|
||||
'canRename' => $this->actor->can('rename', $model),
|
||||
'canDelete' => $this->actor->can('delete', $model),
|
||||
'canHide' => $this->actor->can('hide', $model)
|
||||
];
|
||||
|
||||
if ($model->hidden_at) {
|
||||
|
|
|
@ -83,7 +83,7 @@ class ForumSerializer extends AbstractSerializer
|
|||
'headerHtml' => $this->settings->get('custom_header'),
|
||||
'footerHtml' => $this->settings->get('custom_footer'),
|
||||
'allowSignUp' => (bool) $this->settings->get('allow_sign_up'),
|
||||
'defaultRoute' => $this->settings->get('default_route'),
|
||||
'defaultRoute' => $this->settings->get('default_route'),
|
||||
'canViewForum' => $this->actor->can('viewForum'),
|
||||
'canStartDiscussion' => $this->actor->can('startDiscussion'),
|
||||
'canSearchUsers' => $this->actor->can('searchUsers'),
|
||||
|
|
|
@ -35,10 +35,10 @@ class GroupSerializer extends AbstractSerializer
|
|||
|
||||
return [
|
||||
'nameSingular' => $this->translateGroupName($model->name_singular),
|
||||
'namePlural' => $this->translateGroupName($model->name_plural),
|
||||
'color' => $model->color,
|
||||
'icon' => $model->icon,
|
||||
'isHidden' => $model->is_hidden
|
||||
'namePlural' => $this->translateGroupName($model->name_plural),
|
||||
'color' => $model->color,
|
||||
'icon' => $model->icon,
|
||||
'isHidden' => $model->is_hidden
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ class NotificationSerializer extends AbstractSerializer
|
|||
|
||||
return [
|
||||
'contentType' => $model->type,
|
||||
'content' => $model->data,
|
||||
'createdAt' => $this->formatDate($model->created_at),
|
||||
'isRead' => (bool) $model->read_at
|
||||
'content' => $model->data,
|
||||
'createdAt' => $this->formatDate($model->created_at),
|
||||
'isRead' => (bool) $model->read_at
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@ class PostSerializer extends BasicPostSerializer
|
|||
}
|
||||
|
||||
$attributes += [
|
||||
'canEdit' => $canEdit,
|
||||
'canEdit' => $canEdit,
|
||||
'canDelete' => $this->actor->can('delete', $model),
|
||||
'canHide' => $this->actor->can('hide', $model)
|
||||
'canHide' => $this->actor->can('hide', $model)
|
||||
];
|
||||
|
||||
return $attributes;
|
||||
|
|
|
@ -21,13 +21,13 @@ class UserSerializer extends BasicUserSerializer
|
|||
$attributes = parent::getDefaultAttributes($model);
|
||||
|
||||
$attributes += [
|
||||
'joinTime' => $this->formatDate($model->joined_at),
|
||||
'discussionCount' => (int) $model->discussion_count,
|
||||
'commentCount' => (int) $model->comment_count,
|
||||
'canEdit' => $this->actor->can('edit', $model),
|
||||
'joinTime' => $this->formatDate($model->joined_at),
|
||||
'discussionCount' => (int) $model->discussion_count,
|
||||
'commentCount' => (int) $model->comment_count,
|
||||
'canEdit' => $this->actor->can('edit', $model),
|
||||
'canEditCredentials' => $this->actor->can('editCredentials', $model),
|
||||
'canEditGroups' => $this->actor->can('editGroups', $model),
|
||||
'canDelete' => $this->actor->can('delete', $model),
|
||||
'canEditGroups' => $this->actor->can('editGroups', $model),
|
||||
'canDelete' => $this->actor->can('delete', $model),
|
||||
];
|
||||
|
||||
if ($model->getPreference('discloseOnline') || $this->actor->can('viewLastSeenAt', $model)) {
|
||||
|
@ -39,7 +39,7 @@ class UserSerializer extends BasicUserSerializer
|
|||
if ($attributes['canEditCredentials'] || $this->actor->id === $model->id) {
|
||||
$attributes += [
|
||||
'isEmailConfirmed' => (bool) $model->is_email_confirmed,
|
||||
'email' => $model->email
|
||||
'email' => $model->email
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -453,15 +453,15 @@ class Extension implements Arrayable
|
|||
public function toArray(): array
|
||||
{
|
||||
return (array) array_merge([
|
||||
'id' => $this->getId(),
|
||||
'version' => $this->getVersion(),
|
||||
'path' => $this->getPath(),
|
||||
'icon' => $this->getIcon(),
|
||||
'hasAssets' => $this->hasAssets(),
|
||||
'hasMigrations' => $this->hasMigrations(),
|
||||
'id' => $this->getId(),
|
||||
'version' => $this->getVersion(),
|
||||
'path' => $this->getPath(),
|
||||
'icon' => $this->getIcon(),
|
||||
'hasAssets' => $this->hasAssets(),
|
||||
'hasMigrations' => $this->hasMigrations(),
|
||||
'extensionDependencyIds' => $this->getExtensionDependencyIds(),
|
||||
'optionalDependencyIds' => $this->getOptionalDependencyIds(),
|
||||
'links' => $this->getLinks(),
|
||||
'optionalDependencyIds' => $this->getOptionalDependencyIds(),
|
||||
'links' => $this->getLinks(),
|
||||
], $this->composerJson);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,15 +34,15 @@ class FilesystemServiceProvider extends AbstractServiceProvider
|
|||
return [
|
||||
'flarum-assets' => function (Paths $paths, UrlGenerator $url) {
|
||||
return [
|
||||
'root' => "$paths->public/assets",
|
||||
'url' => $url->to('forum')->path('assets'),
|
||||
'root' => "$paths->public/assets",
|
||||
'url' => $url->to('forum')->path('assets'),
|
||||
'visibility' => Visibility::PUBLIC
|
||||
];
|
||||
},
|
||||
'flarum-avatars' => function (Paths $paths, UrlGenerator $url) {
|
||||
return [
|
||||
'root' => "$paths->public/assets/avatars",
|
||||
'url' => $url->to('forum')->path('assets/avatars')
|
||||
'root' => "$paths->public/assets/avatars",
|
||||
'url' => $url->to('forum')->path('assets/avatars')
|
||||
];
|
||||
},
|
||||
];
|
||||
|
|
|
@ -199,22 +199,22 @@ class Application extends IlluminateContainer implements LaravelApplication
|
|||
public function registerCoreContainerAliases(): void
|
||||
{
|
||||
$aliases = [
|
||||
'app' => [\Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
|
||||
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
|
||||
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
|
||||
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class],
|
||||
'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class],
|
||||
'db' => [\Illuminate\Database\DatabaseManager::class],
|
||||
'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class],
|
||||
'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class],
|
||||
'files' => [\Illuminate\Filesystem\Filesystem::class],
|
||||
'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
|
||||
'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class],
|
||||
'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class],
|
||||
'hash' => [\Illuminate\Contracts\Hashing\Hasher::class],
|
||||
'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class],
|
||||
'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class],
|
||||
'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class],
|
||||
'app' => [\Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
|
||||
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
|
||||
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
|
||||
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class],
|
||||
'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class],
|
||||
'db' => [\Illuminate\Database\DatabaseManager::class],
|
||||
'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class],
|
||||
'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class],
|
||||
'files' => [\Illuminate\Filesystem\Filesystem::class],
|
||||
'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
|
||||
'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class],
|
||||
'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class],
|
||||
'hash' => [\Illuminate\Contracts\Hashing\Hasher::class],
|
||||
'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class],
|
||||
'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class],
|
||||
'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class],
|
||||
];
|
||||
|
||||
foreach ($aliases as $key => $aliasGroup) {
|
||||
|
|
|
@ -142,19 +142,19 @@ class FrontendServiceProvider extends AbstractServiceProvider
|
|||
|
||||
$this->container->singleton('flarum.less.config', function (Container $container) {
|
||||
return [
|
||||
'config-primary-color' => [
|
||||
'config-primary-color' => [
|
||||
'key' => 'theme_primary_color',
|
||||
],
|
||||
'config-secondary-color' => [
|
||||
'key' => 'theme_secondary_color',
|
||||
],
|
||||
'config-dark-mode' => [
|
||||
'config-dark-mode' => [
|
||||
'key' => 'theme_dark_mode',
|
||||
'callback' => function ($value) {
|
||||
return $value ? 'true' : 'false';
|
||||
},
|
||||
],
|
||||
'config-colored-header' => [
|
||||
'config-colored-header' => [
|
||||
'key' => 'theme_colored_header',
|
||||
'callback' => function ($value) {
|
||||
return $value ? 'true' : 'false';
|
||||
|
|
|
@ -28,17 +28,17 @@ class DatabaseConfig implements Arrayable
|
|||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'driver' => $this->driver,
|
||||
'host' => $this->host,
|
||||
'port' => $this->port,
|
||||
'database' => $this->database,
|
||||
'username' => $this->username,
|
||||
'password' => $this->password,
|
||||
'charset' => 'utf8mb4',
|
||||
'driver' => $this->driver,
|
||||
'host' => $this->host,
|
||||
'port' => $this->port,
|
||||
'database' => $this->database,
|
||||
'username' => $this->username,
|
||||
'password' => $this->password,
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => $this->prefix,
|
||||
'strict' => false,
|
||||
'engine' => 'InnoDB',
|
||||
'prefix' => $this->prefix,
|
||||
'strict' => false,
|
||||
'engine' => 'InnoDB',
|
||||
'prefix_indexes' => true
|
||||
];
|
||||
}
|
||||
|
|
|
@ -44,12 +44,12 @@ class StoreConfig implements ReversibleStep
|
|||
private function buildConfig(): array
|
||||
{
|
||||
return [
|
||||
'debug' => $this->debugMode,
|
||||
'debug' => $this->debugMode,
|
||||
'database' => $this->dbConfig->toArray(),
|
||||
'url' => (string) $this->baseUrl,
|
||||
'paths' => $this->getPathsConfig(),
|
||||
'headers' => [
|
||||
'poweredByHeader' => true,
|
||||
'url' => (string) $this->baseUrl,
|
||||
'paths' => $this->getPathsConfig(),
|
||||
'headers' => [
|
||||
'poweredByHeader' => true,
|
||||
'referrerPolicy' => 'same-origin',
|
||||
]
|
||||
];
|
||||
|
@ -58,7 +58,7 @@ class StoreConfig implements ReversibleStep
|
|||
private function getPathsConfig(): array
|
||||
{
|
||||
return [
|
||||
'api' => 'api',
|
||||
'api' => 'api',
|
||||
'admin' => 'admin',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class UnsubscribeToken extends AbstractModel
|
|||
protected $table = 'unsubscribe_tokens';
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'user_id' => 'int',
|
||||
'unsubscribed_at' => 'datetime'
|
||||
];
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ class CreateTest extends TestCase
|
|||
'username' => 'test',
|
||||
'email' => 'test@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => 'file://localhost/etc/passwd'
|
||||
'avatar_url' => 'file://localhost/etc/passwd'
|
||||
], []),
|
||||
'scheme' => 'file'
|
||||
];
|
||||
|
@ -251,28 +251,28 @@ class CreateTest extends TestCase
|
|||
'username' => 'test',
|
||||
'email' => 'test@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => 'https://127.0.0.1/image.png'
|
||||
'avatar_url' => 'https://127.0.0.1/image.png'
|
||||
], []);
|
||||
|
||||
$regTokens[] = RegistrationToken::generate('flarum', '1', [
|
||||
'username' => 'test',
|
||||
'email' => 'test@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => 'https://i_do_not_exist.flarum.org/image.png'
|
||||
'avatar_url' => 'https://i_do_not_exist.flarum.org/image.png'
|
||||
], []);
|
||||
|
||||
$regTokens[] = RegistrationToken::generate('flarum', '1', [
|
||||
'username' => 'test',
|
||||
'email' => 'test@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => '../image.png'
|
||||
'avatar_url' => '../image.png'
|
||||
], []);
|
||||
|
||||
$regTokens[] = RegistrationToken::generate('flarum', '1', [
|
||||
'username' => 'test',
|
||||
'email' => 'test@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => 'image.png'
|
||||
'avatar_url' => 'image.png'
|
||||
], []);
|
||||
|
||||
// Test each reg token
|
||||
|
@ -325,28 +325,28 @@ class CreateTest extends TestCase
|
|||
'username' => 'test1',
|
||||
'email' => 'test1@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png'
|
||||
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png'
|
||||
], []);
|
||||
|
||||
$regTokens[] = RegistrationToken::generate('flarum', '2', [
|
||||
'username' => 'test2',
|
||||
'email' => 'test2@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.jpg'
|
||||
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.jpg'
|
||||
], []);
|
||||
|
||||
$regTokens[] = RegistrationToken::generate('flarum', '3', [
|
||||
'username' => 'test3',
|
||||
'email' => 'test3@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.gif'
|
||||
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.gif'
|
||||
], []);
|
||||
|
||||
$regTokens[] = RegistrationToken::generate('flarum', '4', [
|
||||
'username' => 'test4',
|
||||
'email' => 'test4@machine.local',
|
||||
'is_email_confirmed' => 1,
|
||||
'avatar_url' => 'http://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png'
|
||||
'avatar_url' => 'http://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png'
|
||||
], []);
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@ class FilesystemTest extends TestCase
|
|||
$this->extend((new Extend\Filesystem)->disk('flarum-uploads', function (Paths $paths, UrlGenerator $url) {
|
||||
return [
|
||||
'root' => "$paths->public/assets/uploads",
|
||||
'url' => $url->to('forum')->path('assets/uploads')
|
||||
'url' => $url->to('forum')->path('assets/uploads')
|
||||
];
|
||||
}));
|
||||
|
||||
|
@ -148,7 +148,7 @@ class UploadsDisk
|
|||
{
|
||||
return [
|
||||
'root' => "$paths->public/assets/uploads",
|
||||
'url' => $url->to('forum')->path('assets/uploads')
|
||||
'url' => $url->to('forum')->path('assets/uploads')
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,6 +170,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
|||
protected function database(): ConnectionInterface
|
||||
{
|
||||
$this->app();
|
||||
|
||||
// Set in `BeginTransactionAndSetDatabase` extender.
|
||||
return $this->database;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user