Apply fixes from StyleCI (#35)
This commit is contained in:
parent
8bab3699ba
commit
8eb174a6dc
|
|
@ -15,6 +15,7 @@ class ExecuteInstallation extends Command
|
|||
{
|
||||
if (\App\Http\Controllers\SetupController::checkTablesExist()) {
|
||||
$this->info('You have installed Blessing Skin Server. Nothing to do.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class AdminController extends Controller
|
|||
|
||||
$xAxis = Collection::times(30, function ($number) use ($today) {
|
||||
$time = Carbon::createFromTimestamp($today - (31 - $number) * 86400);
|
||||
|
||||
return $time->format('m-d');
|
||||
});
|
||||
|
||||
|
|
@ -57,13 +58,13 @@ class AdminController extends Controller
|
|||
return [
|
||||
'labels' => [
|
||||
trans('admin.index.user-registration'),
|
||||
trans('admin.index.texture-uploads')
|
||||
trans('admin.index.texture-uploads'),
|
||||
],
|
||||
'xAxis' => $xAxis,
|
||||
'data' => [
|
||||
$xAxis->map($aligning($userRegistration)),
|
||||
$xAxis->map($aligning($textureUploads)),
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +109,7 @@ class AdminController extends Controller
|
|||
|
||||
return view('admin.customize', [
|
||||
'forms' => compact('homepage', 'customJsCss'),
|
||||
'extra' => ['currentSkin' => option('color_scheme')]
|
||||
'extra' => ['currentSkin' => option('color_scheme')],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -455,7 +456,7 @@ class AdminController extends Controller
|
|||
return json(trans('admin.users.operations.score.success'), 0);
|
||||
} elseif ($action == 'permission') {
|
||||
$user->permission = $this->validate($request, [
|
||||
'permission' => 'required|in:-1,0,1'
|
||||
'permission' => 'required|in:-1,0,1',
|
||||
])['permission'];
|
||||
$user->save();
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class AuthController extends Controller
|
|||
{
|
||||
if (Auth::check()) {
|
||||
Auth::logout();
|
||||
|
||||
return json(trans('auth.logout.success'), 0);
|
||||
} else {
|
||||
return json(trans('auth.logout.fail'), 1);
|
||||
|
|
@ -89,7 +90,7 @@ class AuthController extends Controller
|
|||
'player' => (bool) option('register_with_player_name'),
|
||||
'recaptcha' => option('recaptcha_sitekey'),
|
||||
'invisible' => (bool) option('recaptcha_invisible'),
|
||||
]
|
||||
],
|
||||
]);
|
||||
} else {
|
||||
throw new PrettyPageException(trans('auth.register.close'), 7);
|
||||
|
|
@ -166,7 +167,7 @@ class AuthController extends Controller
|
|||
'extra' => [
|
||||
'recaptcha' => option('recaptcha_sitekey'),
|
||||
'invisible' => (bool) option('recaptcha_invisible'),
|
||||
]
|
||||
],
|
||||
]);
|
||||
} else {
|
||||
throw new PrettyPageException(trans('auth.forgot.disabled'), 8);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Exception;
|
||||
use ZipArchive;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\PluginManager;
|
||||
|
|
@ -93,6 +92,7 @@ class MarketController extends Controller
|
|||
} catch (Exception $e) {
|
||||
return json($e->getMessage(), 1);
|
||||
}
|
||||
|
||||
return json(trans('admin.plugins.market.install-success'), 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class PlayerController extends Controller
|
|||
'length' => trans(
|
||||
'user.player.player-name-length',
|
||||
['min' => option('player_name_length_min'), 'max' => option('player_name_length_max')]
|
||||
)
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -186,6 +186,7 @@ class PlayerController extends Controller
|
|||
}
|
||||
}, ['skin', 'cape']);
|
||||
$this->player->save();
|
||||
|
||||
return json(trans('user.player.clear.success', ['name' => $this->player->name]), 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ReportController extends Controller
|
|||
{
|
||||
$data = $this->validate($request, [
|
||||
'tid' => 'required|exists:textures',
|
||||
'reason' => 'required'
|
||||
'reason' => 'required',
|
||||
]);
|
||||
$reporter = auth()->user();
|
||||
|
||||
|
|
@ -71,6 +71,7 @@ class ReportController extends Controller
|
|||
if ($report->informer) {
|
||||
$report->reporterName = $report->informer->nickname;
|
||||
}
|
||||
|
||||
return $report;
|
||||
});
|
||||
|
||||
|
|
@ -84,7 +85,7 @@ class ReportController extends Controller
|
|||
{
|
||||
$data = $this->validate($request, [
|
||||
'id' => 'required|exists:reports',
|
||||
'action' => ['required', Rule::in(['delete', 'ban', 'reject'])]
|
||||
'action' => ['required', Rule::in(['delete', 'ban', 'reject'])],
|
||||
]);
|
||||
$report = Report::find($data['id']);
|
||||
|
||||
|
|
@ -102,6 +103,7 @@ class ReportController extends Controller
|
|||
}
|
||||
$report->status = Report::REJECTED;
|
||||
$report->save();
|
||||
|
||||
return json(trans('general.op-success'), 0, ['status' => Report::REJECTED]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class SetupController extends Controller
|
|||
if ($request->isMethod('get')) {
|
||||
try {
|
||||
DB::getPdo();
|
||||
|
||||
return redirect('setup/info');
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ class TextureController extends Controller
|
|||
return $responses[0]; // @codeCoverageIgnore
|
||||
} else {
|
||||
$png = Minecraft::generateAvatarFromSkin(Storage::disk('textures')->read($t->hash), $size);
|
||||
|
||||
return Response::png(png($png));
|
||||
}
|
||||
}
|
||||
|
|
@ -209,6 +210,7 @@ class TextureController extends Controller
|
|||
{
|
||||
$player = Player::where('name', $player_name)->first();
|
||||
abort_if($player->isBanned(), 403, trans('general.player-banned'));
|
||||
|
||||
return $player;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Log;
|
||||
use Exception;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -32,6 +31,7 @@ class UpdateController extends Controller
|
|||
];
|
||||
$error = $this->error;
|
||||
$extra = ['canUpdate' => $this->canUpdate()];
|
||||
|
||||
return view('admin.update', compact('info', 'error', 'extra'));
|
||||
}
|
||||
|
||||
|
|
@ -51,9 +51,11 @@ class UpdateController extends Controller
|
|||
case 'download':
|
||||
try {
|
||||
$package->download($this->info['url'], $path)->extract(base_path());
|
||||
|
||||
return json(trans('admin.update.complete'), 0);
|
||||
} catch (Exception $e) {
|
||||
report($e);
|
||||
|
||||
return json($e->getMessage(), 1);
|
||||
}
|
||||
case 'progress':
|
||||
|
|
@ -79,12 +81,14 @@ class UpdateController extends Controller
|
|||
$this->error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->info;
|
||||
}
|
||||
|
||||
protected function canUpdate()
|
||||
{
|
||||
$this->getUpdateInfo();
|
||||
|
||||
return Comparator::greaterThan(Arr::get($this->info, 'latest'), $this->currentVersion);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ class UserController extends Controller
|
|||
public function profile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('user.profile')
|
||||
->with('extra', [
|
||||
'unverified' => option('require_verification') && ! $user->verified,
|
||||
|
|
@ -282,6 +283,7 @@ class UserController extends Controller
|
|||
if ($tid == 0) {
|
||||
$user->avatar = 0;
|
||||
$user->save();
|
||||
|
||||
return json(trans('user.profile.avatar.success'), 0);
|
||||
}
|
||||
|
||||
|
|
@ -293,6 +295,7 @@ class UserController extends Controller
|
|||
|
||||
$user->avatar = $tid;
|
||||
$user->save();
|
||||
|
||||
return json(trans('user.profile.avatar.success'), 0);
|
||||
} else {
|
||||
return json(trans('skinlib.non-existent'), 1);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class CheckAdministrator
|
|||
public function handle($request, \Closure $next)
|
||||
{
|
||||
abort_unless(auth()->user()->isAdmin(), 403, trans('auth.check.admin'));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class CheckSuperAdmin
|
|||
public function handle($request, Closure $next)
|
||||
{
|
||||
abort_if(auth()->user()->permission != User::SUPER_ADMIN, 403, trans('auth.check.super-admin'));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class CheckUserVerified
|
|||
public function handle($request, \Closure $next)
|
||||
{
|
||||
abort_if(option('require_verification') && ! auth()->user()->verified, 403, trans('auth.check.verified'));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class CacheAvatarPreview
|
|||
|
||||
$content = Cache::rememberForever($key, function () use ($texture, $size) {
|
||||
$res = Storage::disk('textures')->read($texture->hash);
|
||||
|
||||
return png(Minecraft::generateAvatarFromSkin($res, $size));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Listeners;
|
||||
|
||||
use Cache;
|
||||
use Storage;
|
||||
use App\Events;
|
||||
use App\Models\Player;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
|
@ -25,6 +24,7 @@ class CachePlayerExists
|
|||
|
||||
if (! $player) {
|
||||
Cache::forever($key, '1');
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Listeners;
|
||||
|
||||
use Cache;
|
||||
use Storage;
|
||||
use App\Models\Player;
|
||||
use App\Events\GetPlayerJson;
|
||||
use App\Events\PlayerProfileUpdated;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class CacheSkinPreview
|
|||
});
|
||||
|
||||
return response()->png($content, 200, [
|
||||
'Last-Modified' => Storage::disk('textures')->lastModified($texture->hash)
|
||||
'Last-Modified' => Storage::disk('textures')->lastModified($texture->hash),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class Report extends Model
|
|||
public const CREATED_AT = 'report_at';
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
public const PENDING = 0;
|
||||
public const PENDING = 0;
|
||||
public const RESOLVED = 1;
|
||||
public const REJECTED = 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ class User extends Authenticatable
|
|||
public function getPlayerNameAttribute()
|
||||
{
|
||||
$player = $this->players->first();
|
||||
|
||||
return $player ? $player->name : '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,11 @@ class Captcha implements Rule
|
|||
'form_params' => [
|
||||
'secret' => $secretkey,
|
||||
'response' => $value,
|
||||
]
|
||||
],
|
||||
]);
|
||||
if ($response->getStatusCode() == 200) {
|
||||
$body = json_decode((string) $response->getBody());
|
||||
|
||||
return $body->success;
|
||||
}
|
||||
} catch (\GuzzleHttp\Exception\RequestException $e) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class PackageManager
|
|||
try {
|
||||
$this->guzzle->request('GET', $url, [
|
||||
'sink' => $path,
|
||||
'progress' => $this->onProgress
|
||||
'progress' => $this->onProgress,
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception(trans('admin.download.errors.download', ['error' => $e->getMessage()]));
|
||||
|
|
|
|||
|
|
@ -71,17 +71,11 @@ class Plugin
|
|||
$this->packageInfo = $packageInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
return $this->packageInfoAttribute(snake_case($name, '-'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
return isset($this->{$name}) || $this->packageInfoAttribute(snake_case($name, '-'));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace App\Services;
|
|||
|
||||
use Storage;
|
||||
use App\Events;
|
||||
use App\Services\Option;
|
||||
use Composer\Semver\Semver;
|
||||
use Illuminate\Support\Arr;
|
||||
use Composer\Semver\Comparator;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
if (! function_exists('webpack_assets')) {
|
||||
function webpack_assets($relativeUri)
|
||||
|
|
@ -13,6 +12,7 @@ if (! function_exists('webpack_assets')) {
|
|||
} else {
|
||||
$path = app('webpack')->$relativeUri;
|
||||
$cdn = option('cdn_address');
|
||||
|
||||
return $cdn ? "$cdn/app/$path" : url("/app/$path");
|
||||
}
|
||||
}
|
||||
|
|
@ -192,6 +192,7 @@ if (! function_exists('option')) {
|
|||
|
||||
if (is_array($key)) {
|
||||
$options->set($key);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -360,6 +361,7 @@ if (! function_exists('png')) {
|
|||
$image = ob_get_contents();
|
||||
ob_end_clean();
|
||||
imagedestroy($resource);
|
||||
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ Route::group(['prefix' => 'auth'], function () {
|
|||
*/
|
||||
Route::group([
|
||||
'middleware' => ['web', 'auth', \App\Http\Middleware\RequireBindPlayer::class],
|
||||
'prefix' => 'user'
|
||||
'prefix' => 'user',
|
||||
], function () {
|
||||
Route::any('', 'UserController@index');
|
||||
Route::get('/score-info', 'UserController@scoreInfo');
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class AdminControllerTest extends BrowserKitTestCase
|
|||
$this->getJson('/admin/chart')
|
||||
->seeJson(['labels' => [
|
||||
trans('admin.index.user-registration'),
|
||||
trans('admin.index.texture-uploads')
|
||||
trans('admin.index.texture-uploads'),
|
||||
]])
|
||||
->seeJsonStructure(['labels', 'xAxis', 'data']);
|
||||
}
|
||||
|
|
@ -468,7 +468,7 @@ class AdminControllerTest extends BrowserKitTestCase
|
|||
$this->postJson('/admin/users', [
|
||||
'uid' => $user->uid,
|
||||
'action' => 'permission',
|
||||
'permission' => -2
|
||||
'permission' => -2,
|
||||
])->seeJsonStructure(['errors' => ['permission']]);
|
||||
$user = User::find($user->uid);
|
||||
$this->assertEquals(User::NORMAL, $user->permission);
|
||||
|
|
@ -477,7 +477,7 @@ class AdminControllerTest extends BrowserKitTestCase
|
|||
$this->postJson('/admin/users', [
|
||||
'uid' => $user->uid,
|
||||
'action' => 'permission',
|
||||
'permission' => -1
|
||||
'permission' => -1,
|
||||
])->seeJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('admin.users.operations.permission'),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ class AuthControllerTest extends TestCase
|
|||
{
|
||||
parent::setUp();
|
||||
app()->instance(\App\Rules\Captcha::class, new class extends \App\Rules\Captcha {
|
||||
public function __construct(\GuzzleHttp\Client $client = null) {}
|
||||
public function __construct(\GuzzleHttp\Client $client = null)
|
||||
{
|
||||
}
|
||||
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use Storage;
|
|||
use App\Models\Texture;
|
||||
use App\Events\GetAvatarPreview;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use App\Listeners\CacheAvatarPreview;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class CacheAvatarPreviewTest extends TestCase
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ use Cache;
|
|||
use Event;
|
||||
use App\Events;
|
||||
use App\Models\Player;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use App\Listeners\CachePlayerExists;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class CachePlayerExistsTest extends TestCase
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ use Cache;
|
|||
use Event;
|
||||
use App\Models\Player;
|
||||
use App\Events\GetPlayerJson;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use App\Listeners\CachePlayerJson;
|
||||
use App\Events\PlayerProfileUpdated;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use Storage;
|
|||
use App\Models\Texture;
|
||||
use App\Events\GetSkinPreview;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use App\Listeners\CacheSkinPreview;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class CacheSkinPreviewTest extends TestCase
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Tests;
|
||||
|
||||
use DB;
|
||||
use App\Models\User;
|
||||
use App\Models\Player;
|
||||
use App\Services\Facades\Option;
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ class PlayerControllerTest extends TestCase
|
|||
$this->postJson('/user/player/bind', ['player' => 'abc'])
|
||||
->assertJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('user.player.bind.success')
|
||||
'msg' => trans('user.player.bind.success'),
|
||||
]);
|
||||
Event::assertDispatched(Events\CheckPlayerExists::class);
|
||||
Event::assertDispatched(Events\PlayerWillBeAdded::class);
|
||||
|
|
@ -322,7 +322,7 @@ class PlayerControllerTest extends TestCase
|
|||
$this->postJson('/user/player/bind', ['player' => $player2->name])
|
||||
->assertJson([
|
||||
'errno' => 1,
|
||||
'msg' => trans('user.player.rename.repeated')
|
||||
'msg' => trans('user.player.rename.repeated'),
|
||||
]);
|
||||
|
||||
$this->postJson('/user/player/bind', ['player' => $player->name])
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ReportControllerTest extends TestCase
|
|||
$this->postJson('/skinlib/report', ['tid' => $texture->tid, 'reason' => 'reason'])
|
||||
->assertJson([
|
||||
'errno' => 1,
|
||||
'msg' => trans('skinlib.upload.lack-score')
|
||||
'msg' => trans('skinlib.upload.lack-score'),
|
||||
]);
|
||||
|
||||
// Success
|
||||
|
|
@ -44,7 +44,7 @@ class ReportControllerTest extends TestCase
|
|||
$this->postJson('/skinlib/report', ['tid' => $texture->tid, 'reason' => 'reason'])
|
||||
->assertJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('skinlib.report.success')
|
||||
'msg' => trans('skinlib.report.success'),
|
||||
]);
|
||||
$user->refresh();
|
||||
$this->assertEquals(5, $user->score);
|
||||
|
|
@ -58,7 +58,7 @@ class ReportControllerTest extends TestCase
|
|||
$this->postJson('/skinlib/report', ['tid' => $texture->tid, 'reason' => 'reason'])
|
||||
->assertJson([
|
||||
'errno' => 1,
|
||||
'msg' => trans('skinlib.report.duplicate')
|
||||
'msg' => trans('skinlib.report.duplicate'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ class ReportControllerTest extends TestCase
|
|||
'status' => Report::PENDING,
|
||||
'uploaderName' => $uploader->nickname,
|
||||
'reporterName' => $reporter->nickname,
|
||||
]]
|
||||
]],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ class ReportControllerTest extends TestCase
|
|||
$this->postJson('/admin/reports', ['id' => $report->id, 'action' => 'reject'])
|
||||
->assertJson([
|
||||
'errno' => 1,
|
||||
'msg' => trans('admin.report-reviewed')
|
||||
'msg' => trans('admin.report-reviewed'),
|
||||
]);
|
||||
|
||||
// Reject
|
||||
|
|
@ -159,7 +159,7 @@ class ReportControllerTest extends TestCase
|
|||
->assertJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('general.op-success'),
|
||||
'status' => Report::REJECTED
|
||||
'status' => Report::REJECTED,
|
||||
]);
|
||||
$report->refresh();
|
||||
$reporter->refresh();
|
||||
|
|
@ -186,7 +186,7 @@ class ReportControllerTest extends TestCase
|
|||
->assertJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('general.op-success'),
|
||||
'status' => Report::RESOLVED
|
||||
'status' => Report::RESOLVED,
|
||||
]);
|
||||
$report->refresh();
|
||||
$reporter->refresh();
|
||||
|
|
@ -207,7 +207,7 @@ class ReportControllerTest extends TestCase
|
|||
->assertJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('general.op-success'),
|
||||
'status' => Report::RESOLVED
|
||||
'status' => Report::RESOLVED,
|
||||
]);
|
||||
$reporter->refresh();
|
||||
$this->assertEquals(User::BANNED, $uploader->permission);
|
||||
|
|
@ -223,7 +223,7 @@ class ReportControllerTest extends TestCase
|
|||
$this->postJson('/admin/reports', ['id' => $report->id, 'action' => 'ban'])
|
||||
->assertJson([
|
||||
'errno' => 1,
|
||||
'msg' => trans('admin.users.operations.no-permission')
|
||||
'msg' => trans('admin.users.operations.no-permission'),
|
||||
]);
|
||||
$report->refresh();
|
||||
$this->assertEquals(Report::PENDING, $report->status);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class CaptchaTest extends TestCase
|
|||
option(['recaptcha_secretkey' => 'secret']);
|
||||
$mock = new MockHandler([
|
||||
new Response(403),
|
||||
new Response(200, [], json_encode(['success' => true]))
|
||||
new Response(200, [], json_encode(['success' => true])),
|
||||
]);
|
||||
$handler = HandlerStack::create($mock);
|
||||
$client = new Client(['handler' => $handler]);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ class HookTest extends TestCase
|
|||
public function testAddRoute()
|
||||
{
|
||||
Hook::addRoute(function ($route) {
|
||||
$route->any('/test-hook', function () {});
|
||||
$route->any('/test-hook', function () {
|
||||
});
|
||||
});
|
||||
event(new \App\Events\ConfigureRoutes(resolve(\Illuminate\Routing\Router::class)));
|
||||
$this->get('/test-hook')->assertSuccessful();
|
||||
|
|
|
|||
|
|
@ -693,7 +693,7 @@ class SkinlibControllerTest extends TestCase
|
|||
// Private texture
|
||||
$texture = factory(Texture::class)->create([
|
||||
'uploader' => $uploader->uid,
|
||||
'public' => false
|
||||
'public' => false,
|
||||
]);
|
||||
$uploader->refresh();
|
||||
$this->actingAs($uploader)
|
||||
|
|
|
|||
|
|
@ -2,15 +2,10 @@
|
|||
|
||||
namespace Tests;
|
||||
|
||||
use Cache;
|
||||
use Exception;
|
||||
use Carbon\Carbon;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use App\Services\PackageManager;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Tests\Concerns\MocksGuzzleClient;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ class UserControllerTest extends TestCase
|
|||
|
||||
// Reset avatar
|
||||
$this->postJson('/user/profile/avatar', ['tid' => 0])
|
||||
->assertJson(['errno' => 0,]);
|
||||
->assertJson(['errno' => 0]);
|
||||
$this->assertEquals(0, User::find($user->uid)->avatar);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user