1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

chore(deps): bump glob-parent from 3.1.0 to 5.1.2 in /extensions/emoji/js (#3345)

* chore(deps): bump glob-parent in /extensions/emoji/js

Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 3.1.0 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply fixes from StyleCI

[ci skip] [skip ci]

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
dependabot[bot]
2022-03-11 18:11:20 -05:00
committed by GitHub
parent 379c06332a
commit 37a882118a
128 changed files with 9645 additions and 11730 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,10 @@
<?php
/*
* This file is part of flarum/nickname.
* This file is part of Flarum.
*
* Copyright (c) 2020 Flarum.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
@@ -21,12 +19,12 @@ use Flarum\User\UserValidator;
return [
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/forum.js'),
->js(__DIR__.'/js/dist/forum.js'),
(new Extend\Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js'),
->js(__DIR__.'/js/dist/admin.js'),
new Extend\Locales(__DIR__ . '/locale'),
new Extend\Locales(__DIR__.'/locale'),
(new Extend\User())
->displayNameDriver('nickname', NicknameDriver::class),

View File

@@ -1,18 +1,25 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
return [
'up' => function(Builder $schema) {
if (!$schema->hasColumn('users', 'nickname')) {
$schema->table('users', function (Blueprint $table) use ($schema) {
'up' => function (Builder $schema) {
if (! $schema->hasColumn('users', 'nickname')) {
$schema->table('users', function (Blueprint $table) {
$table->string('nickname', 150)->after('username')->index()->nullable();
});
}
},
'down' => function(Builder $schema) {
$schema->table('users', function (Blueprint $table) use ($schema) {
'down' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
$table->dropColumn('nickname');
});
}

View File

@@ -1,5 +1,12 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;

View File

@@ -32,11 +32,11 @@ class UserPolicy extends AbstractPolicy
*/
public function editNickname(User $actor, User $user)
{
if ($actor->isGuest() && !$user->exists && $this->settings->get('flarum-nicknames.set_on_registration')) {
if ($actor->isGuest() && ! $user->exists && $this->settings->get('flarum-nicknames.set_on_registration')) {
return $this->allow();
} else if ($actor->id === $user->id && $actor->hasPermission('user.editOwnNickname')) {
} elseif ($actor->id === $user->id && $actor->hasPermission('user.editOwnNickname')) {
return $this->allow();
} else if ($actor->can('edit', $user)) {
} elseif ($actor->can('edit', $user)) {
return $this->allow();
}
}

View File

@@ -1,5 +1,11 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
@@ -19,7 +25,6 @@ class AddNicknameValidation
*/
protected $translator;
public function __construct(SettingsRepositoryInterface $settings, TranslatorInterface $translator)
{
$this->settings = $settings;
@@ -34,12 +39,12 @@ class AddNicknameValidation
$rules['nickname'] = [
function ($attribute, $value, $fail) {
$regex = $this->settings->get('flarum-nicknames.regex');
if ($regex && !preg_match_all("/$regex/", $value)) {
if ($regex && ! preg_match_all("/$regex/", $value)) {
$this->translator->trans('flarum-nicknames.api.invalid_nickname_message');
}
},
'min:' . $this->settings->get('flarum-nicknames.min'),
'max:' . $this->settings->get('flarum-nicknames.max'),
'min:'.$this->settings->get('flarum-nicknames.min'),
'max:'.$this->settings->get('flarum-nicknames.max'),
'nullable'
];

View File

@@ -1,12 +1,19 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
use Flarum\User\DisplayName\DriverInterface;
use Flarum\User\User;
class NicknameDriver implements DriverInterface {
class NicknameDriver implements DriverInterface
{
public function displayName(User $user): string
{
return $user->nickname ? $user->nickname : $user->username;

View File

@@ -1,5 +1,11 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
@@ -14,7 +20,6 @@ use Flarum\Search\GambitInterface;
use Flarum\Search\SearchState;
use Flarum\User\UserRepository;
class NicknameFullTextGambit implements GambitInterface
{
/**
@@ -40,7 +45,7 @@ class NicknameFullTextGambit implements GambitInterface
->query()
->select('id')
->where('username', 'like', "{$searchValue}%")
->orWhere('nickname', 'like',"{$searchValue}%");
->orWhere('nickname', 'like', "{$searchValue}%");
}
/**

View File

@@ -1,19 +1,27 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\Event\Saving;
use Flarum\User\Exception\PermissionDeniedException;
use Illuminate\Support\Arr;
class SaveNicknameToDatabase {
class SaveNicknameToDatabase
{
/**
* @var SettingsRepositoryInterface
*/
protected $settings;
public function __construct(SettingsRepositoryInterface $settings) {
public function __construct(SettingsRepositoryInterface $settings)
{
$this->settings = $settings;
}

View File

@@ -13,9 +13,9 @@ use Flarum\Extend;
use Flarum\Foundation\Paths;
use Flarum\Frontend\Document;
use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use Flarum\PackageManager\Exception\ExceptionHandler;
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Exception\ExceptionHandler;
use Flarum\PackageManager\Exception\MajorUpdateFailedException;
use Flarum\PackageManager\Settings\LastUpdateCheck;
use Flarum\PackageManager\Settings\LastUpdateRun;
@@ -32,8 +32,8 @@ return [
->post('/package-manager/global-update', 'package-manager.global-update', Api\Controller\GlobalUpdateController::class),
(new Extend\Frontend('admin'))
->css(__DIR__ . '/less/admin.less')
->js(__DIR__ . '/js/dist/admin.js')
->css(__DIR__.'/less/admin.less')
->js(__DIR__.'/js/dist/admin.js')
->content(function (Document $document) {
$paths = resolve(Paths::class);
@@ -43,7 +43,7 @@ return [
&& is_writable($paths->base.'/composer.lock');
}),
new Extend\Locales(__DIR__ . '/locale'),
new Extend\Locales(__DIR__.'/locale'),
(new Extend\Settings())
->default(LastUpdateCheck::key(), json_encode(LastUpdateCheck::default()))

View File

@@ -1,5 +1,12 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

View File

@@ -10,13 +10,12 @@
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\CheckForUpdates;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Flarum\PackageManager\Command\CheckForUpdates;
class CheckForUpdatesController implements RequestHandlerInterface
{

View File

@@ -11,11 +11,11 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\GlobalUpdate;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\GlobalUpdate;
use Psr\Http\Server\RequestHandlerInterface;
class GlobalUpdateController implements RequestHandlerInterface
{

View File

@@ -9,10 +9,10 @@
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Api\Controller\AbstractListController;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Api\Serializer\TaskSerializer;
use Flarum\PackageManager\Task;
use Flarum\Api\Controller\AbstractListController;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@@ -11,12 +11,12 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\MajorUpdate;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\MajorUpdate;
use Psr\Http\Server\RequestHandlerInterface;
class MajorUpdateController implements RequestHandlerInterface
{

View File

@@ -11,11 +11,11 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\MinorUpdate;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\MinorUpdate;
use Psr\Http\Server\RequestHandlerInterface;
class MinorUpdateController implements RequestHandlerInterface
{

View File

@@ -11,11 +11,11 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\RemoveExtension;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\RemoveExtension;
use Psr\Http\Server\RequestHandlerInterface;
class RemoveExtensionController implements RequestHandlerInterface

View File

@@ -10,17 +10,13 @@
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\RequireExtension;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Flarum\PackageManager\Api\Serializer\ExtensionSerializer;
use Flarum\PackageManager\Command\RequireExtension;
use Flarum\PackageManager\Extension\ExtensionUtils;
use Flarum\Api\Controller\AbstractCreateController;
use Flarum\Http\RequestUtil;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;
use Psr\Http\Server\RequestHandlerInterface;
class RequireExtensionController implements RequestHandlerInterface
{

View File

@@ -11,12 +11,12 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\UpdateExtension;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\UpdateExtension;
use Psr\Http\Server\RequestHandlerInterface;
class UpdateExtensionController implements RequestHandlerInterface
{

View File

@@ -15,8 +15,8 @@ use Flarum\PackageManager\Command\WhyNot;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
class WhyNotController implements RequestHandlerInterface
{

View File

@@ -33,7 +33,7 @@ class CheckForUpdatesHandler
}
/**
* We run two commands here
* We run two commands here.
*
* `composer outdated -D --format json`
* This queries latest versions for all direct packages, so it can include major updates,

View File

@@ -11,9 +11,9 @@ namespace Flarum\PackageManager\Command;
use Flarum\Bus\Dispatcher as FlarumDispatcher;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class GlobalUpdateHandler
@@ -48,7 +48,7 @@ class GlobalUpdateHandler
$command->actor->assertAdmin();
$output = $this->composer->run(
new StringInput("update --prefer-dist --no-dev -a --with-all-dependencies")
new StringInput('update --prefer-dist --no-dev -a --with-all-dependencies')
);
if ($output->getExitCode() !== 0) {

View File

@@ -11,11 +11,11 @@ namespace Flarum\PackageManager\Command;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Flarum\PackageManager\Composer\ComposerJson;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\MajorUpdateFailedException;
use Flarum\PackageManager\Exception\NoNewMajorVersionException;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Settings\LastUpdateCheck;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\ArrayInput;
class MajorUpdateHandler

View File

@@ -11,10 +11,10 @@ namespace Flarum\PackageManager\Command;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Flarum\PackageManager\Composer\ComposerJson;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Settings\LastUpdateCheck;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class MinorUpdateHandler
@@ -61,7 +61,7 @@ class MinorUpdateHandler
$this->composerJson->require('flarum/core', $coreRequirement);
$output = $this->composer->run(
new StringInput("update --prefer-dist --no-dev -a --with-all-dependencies")
new StringInput('update --prefer-dist --no-dev -a --with-all-dependencies')
);
if ($output->getExitCode() !== 0) {

View File

@@ -11,10 +11,10 @@ namespace Flarum\PackageManager\Command;
use Flarum\Extension\ExtensionManager;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
use Flarum\PackageManager\Extension\Event\Removed;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class RemoveExtensionHandler

View File

@@ -11,12 +11,12 @@ namespace Flarum\PackageManager\Command;
use Flarum\Extension\ExtensionManager;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use Flarum\PackageManager\Exception\ExtensionAlreadyInstalledException;
use Flarum\PackageManager\Extension\Event\Installed;
use Flarum\PackageManager\Extension\ExtensionUtils;
use Flarum\PackageManager\RequirePackageValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class RequireExtensionHandler
@@ -70,7 +70,7 @@ class RequireExtensionHandler
// Auto append :* if not requiring a specific version.
if (strpos($packageName, ':') === false) {
$packageName .= ":*";
$packageName .= ':*';
}
$output = $this->composer->run(

View File

@@ -11,12 +11,12 @@ namespace Flarum\PackageManager\Command;
use Flarum\Extension\ExtensionManager;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
use Flarum\PackageManager\Extension\Event\Updated;
use Flarum\PackageManager\UpdateExtensionValidator;
use Flarum\PackageManager\Settings\LastUpdateCheck;
use Flarum\PackageManager\UpdateExtensionValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class UpdateExtensionHandler
@@ -51,7 +51,8 @@ class UpdateExtensionHandler
ExtensionManager $extensions,
UpdateExtensionValidator $validator,
LastUpdateCheck $lastUpdateCheck,
Dispatcher $events)
Dispatcher $events
)
{
$this->composer = $composer;
$this->extensions = $extensions;

View File

@@ -10,9 +10,9 @@
namespace Flarum\PackageManager\Command;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use Flarum\PackageManager\WhyNotValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class WhyNotHandler

View File

@@ -66,7 +66,7 @@ class ComposerJson
protected function getComposerJsonPath(): string
{
return $this->paths->base . '/composer.json';
return $this->paths->base.'/composer.json';
}
/**

View File

@@ -16,7 +16,7 @@ class NoNewMajorVersionException extends Exception implements KnownError
{
public function __construct()
{
parent::__construct("No new major version known of. Try checking for updates first.");
parent::__construct('No new major version known of. Try checking for updates first.');
}
public function getType(): string

View File

@@ -17,15 +17,15 @@ use Flarum\Foundation\Paths;
use Flarum\Frontend\RecompileFrontendAssets;
use Flarum\Locale\LocaleManager;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Extension\Event\Updated;
use Flarum\PackageManager\Listener\ClearCacheAfterUpdate;
use Flarum\PackageManager\Listener\ReCheckForUpdates;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Events\Dispatcher;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Extension\Event\Updated;
use Flarum\PackageManager\Listener\ClearCacheAfterUpdate;
class PackageManagerServiceProvider extends AbstractServiceProvider
{
@@ -42,7 +42,7 @@ class PackageManagerServiceProvider extends AbstractServiceProvider
putenv("COMPOSER_HOME={$paths->storage}/.composer");
putenv("COMPOSER={$paths->base}/composer.json");
putenv("COMPOSER_DISABLE_XDEBUG_WARN=1");
putenv('COMPOSER_DISABLE_XDEBUG_WARN=1');
Config::$defaultConfig['vendor-dir'] = $paths->vendor;
// When running simple require, update and remove commands on packages,

View File

@@ -12,7 +12,6 @@ namespace Flarum\PackageManager\Settings;
use Carbon\Carbon;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
class LastUpdateCheck implements JsonSetting
{

View File

@@ -39,7 +39,7 @@ class LastUpdateRun implements JsonSetting
public function for(string $update): self
{
if (! in_array($update, [FlarumUpdated::MAJOR, FlarumUpdated::MINOR, FlarumUpdated::GLOBAL])) {
throw new \InvalidArgumentException("Last update runs can only be for one of: minor, major, global");
throw new \InvalidArgumentException('Last update runs can only be for one of: minor, major, global');
}
$this->activeUpdate = $update;

View File

@@ -1,5 +1,12 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Tests\integration;
trait ChangeComposerConfig

View File

@@ -9,19 +9,17 @@
namespace Flarum\PackageManager\Tests\integration;
use Flarum\Foundation\Paths;
trait DummyExtensions
{
protected function makeDummyExtensionCompatibleWith(string $name, string $coreVersions): void
{
$dirName = $this->tmpDir() . "/packages/" . str_replace('/', '-', $name);
$dirName = $this->tmpDir().'/packages/'.str_replace('/', '-', $name);
if (! file_exists($dirName)) {
mkdir($dirName);
}
file_put_contents($dirName."/composer.json", json_encode([
file_put_contents($dirName.'/composer.json', json_encode([
'name' => $name,
'version' => '1.0.0',
'require' => [

View File

@@ -37,8 +37,8 @@ trait RefreshComposerSetup
$it = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
foreach($files as $file) {
if ($file->isDir()){
foreach ($files as $file) {
if ($file->isDir()) {
rmdir($file->getRealPath());
} else {
unlink($file->getRealPath());

View File

@@ -16,7 +16,8 @@ use Illuminate\Support\Arr;
class CheckForUpdatesTest extends TestCase
{
use RefreshComposerSetup, ChangeComposerConfig;
use RefreshComposerSetup;
use ChangeComposerConfig;
/**
* @test

View File

@@ -16,14 +16,16 @@ use Flarum\PackageManager\Tests\integration\TestCase;
class MajorUpdateTest extends TestCase
{
use RefreshComposerSetup, ChangeComposerConfig, DummyExtensions;
use RefreshComposerSetup;
use ChangeComposerConfig;
use DummyExtensions;
/**
* @test
*/
public function cannot_update_when_no_update_check_ran()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-incompatible-extension", ">=0.1.0-beta.15 <=0.1.0-beta.16");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-incompatible-extension', '>=0.1.0-beta.15 <=0.1.0-beta.16');
$this->setComposerConfig([
'require' => [
'flarum/core' => '^0.1.0-beta.15',
@@ -48,7 +50,7 @@ class MajorUpdateTest extends TestCase
*/
public function can_update_when_major_update_available()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-compatible-extension", "^0.1.0-beta.15 | ^1.0.0");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-compatible-extension', '^0.1.0-beta.15 | ^1.0.0');
$this->setComposerConfig([
'require' => [
'flarum/core' => '^0.1.0-beta.15',
@@ -80,9 +82,9 @@ class MajorUpdateTest extends TestCase
)[0]['latest-major'];
$this->assertEquals(200, $response->getStatusCode());
$this->assertPackageVersion("flarum/core", str_replace('v', '^', $newMinorCoreVersion));
$this->assertPackageVersion("flarum/tags", "*");
$this->assertPackageVersion("flarum/dummy-compatible-extension", "*");
$this->assertPackageVersion('flarum/core', str_replace('v', '^', $newMinorCoreVersion));
$this->assertPackageVersion('flarum/tags', '*');
$this->assertPackageVersion('flarum/dummy-compatible-extension', '*');
}
/**
@@ -90,9 +92,9 @@ class MajorUpdateTest extends TestCase
*/
public function cannot_update_with_incompatible_extensions()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-incompatible-extension-a", ">=0.1.0-beta.16 <0.1.0-beta.17");
$this->makeDummyExtensionCompatibleWith("flarum/dummy-incompatible-extension-b", ">=0.1.0-beta.16 <=0.1.0-beta.17");
$this->makeDummyExtensionCompatibleWith("flarum/dummy-incompatible-extension-c", "0.1.0-beta.16");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-incompatible-extension-a', '>=0.1.0-beta.16 <0.1.0-beta.17');
$this->makeDummyExtensionCompatibleWith('flarum/dummy-incompatible-extension-b', '>=0.1.0-beta.16 <=0.1.0-beta.17');
$this->makeDummyExtensionCompatibleWith('flarum/dummy-incompatible-extension-c', '0.1.0-beta.16');
$this->setComposerConfig([
'require' => [
'flarum/core' => '^0.1.0-beta.16',

View File

@@ -18,14 +18,16 @@ use Flarum\PackageManager\Tests\integration\TestCase;
class MinorUpdateTest extends TestCase
{
use RefreshComposerSetup, ChangeComposerConfig, DummyExtensions;
use RefreshComposerSetup;
use ChangeComposerConfig;
use DummyExtensions;
/**
* @test--
*/
public function can_update_to_next_minor_version()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-compatible-extension", "^1.0.0");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-compatible-extension', '^1.0.0');
$this->setComposerConfig([
'require' => [
// The only reason we don't set this to `^1.0.0` and let it update to latest minor,
@@ -56,7 +58,7 @@ class MinorUpdateTest extends TestCase
*/
public function can_update_with_latest_ext_incompatible_with_latest_core()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-extension", "1.0.0");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-extension', '1.0.0');
$this->setComposerConfig([
'require' => [
'flarum/core' => '>=1.0.0 <=1.1.0',
@@ -84,8 +86,8 @@ class MinorUpdateTest extends TestCase
$lastUpdateRun = $this->app()->getContainer()->make(LastUpdateRun::class);
$this->assertEquals(200, $response->getStatusCode());
$this->assertPackageVersion("flarum/tags", "*");
$this->assertPackageVersion("flarum/dummy-extension", "*");
$this->assertPackageVersion('flarum/tags', '*');
$this->assertPackageVersion('flarum/dummy-extension', '*');
$this->assertEquals([
'flarum/core',
'flarum/lang-english',

View File

@@ -7,8 +7,8 @@
* LICENSE file that was distributed with this source code.
*/
use Flarum\Testing\integration\Setup\SetupScript;
use Flarum\PackageManager\Tests\integration\SetupComposer;
use Flarum\Testing\integration\Setup\SetupScript;
require __DIR__.'/../../vendor/autoload.php';

View File

@@ -3,10 +3,8 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Extend;

View File

@@ -3,10 +3,8 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Statistics;