style: apply php-cs-fixer fixes
This commit is contained in:
parent
cdfb972bd0
commit
24ad29ea99
|
|
@ -86,7 +86,7 @@ class AdminController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
PluginManager $plugins,
|
PluginManager $plugins,
|
||||||
Filesystem $filesystem,
|
Filesystem $filesystem,
|
||||||
Filter $filter
|
Filter $filter,
|
||||||
) {
|
) {
|
||||||
$db = config('database.connections.'.config('database.default'));
|
$db = config('database.connections.'.config('database.default'));
|
||||||
$dbType = Arr::get([
|
$dbType = Arr::get([
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class AuthController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Rules\Captcha $captcha,
|
Rules\Captcha $captcha,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter
|
Filter $filter,
|
||||||
) {
|
) {
|
||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
'identification' => 'required',
|
'identification' => 'required',
|
||||||
|
|
@ -151,7 +151,7 @@ class AuthController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Rules\Captcha $captcha,
|
Rules\Captcha $captcha,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter
|
Filter $filter,
|
||||||
) {
|
) {
|
||||||
$can = $filter->apply('can_register', null);
|
$can = $filter->apply('can_register', null);
|
||||||
if ($can instanceof Rejection) {
|
if ($can instanceof Rejection) {
|
||||||
|
|
@ -248,7 +248,7 @@ class AuthController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Rules\Captcha $captcha,
|
Rules\Captcha $captcha,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter
|
Filter $filter,
|
||||||
) {
|
) {
|
||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
'email' => 'required|email',
|
'email' => 'required|email',
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class ClosetController extends Controller
|
||||||
public function add(
|
public function add(
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter
|
Filter $filter,
|
||||||
) {
|
) {
|
||||||
['tid' => $tid, 'name' => $name] = $request->validate([
|
['tid' => $tid, 'name' => $name] = $request->validate([
|
||||||
'tid' => 'required|integer',
|
'tid' => 'required|integer',
|
||||||
|
|
@ -132,7 +132,7 @@ class ClosetController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter,
|
Filter $filter,
|
||||||
$tid
|
$tid,
|
||||||
) {
|
) {
|
||||||
['name' => $name] = $request->validate(['name' => 'required']);
|
['name' => $name] = $request->validate(['name' => 'required']);
|
||||||
/** @var User */
|
/** @var User */
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class PlayerController extends Controller
|
||||||
public function delete(
|
public function delete(
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter,
|
Filter $filter,
|
||||||
Player $player
|
Player $player,
|
||||||
) {
|
) {
|
||||||
/** @var User */
|
/** @var User */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
@ -157,7 +157,7 @@ class PlayerController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter,
|
Filter $filter,
|
||||||
Player $player
|
Player $player,
|
||||||
) {
|
) {
|
||||||
$name = $request->validate([
|
$name = $request->validate([
|
||||||
'name' => [
|
'name' => [
|
||||||
|
|
@ -194,7 +194,7 @@ class PlayerController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter,
|
Filter $filter,
|
||||||
Player $player
|
Player $player,
|
||||||
) {
|
) {
|
||||||
/** @var User */
|
/** @var User */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
@ -234,7 +234,7 @@ class PlayerController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter,
|
Filter $filter,
|
||||||
Player $player
|
Player $player,
|
||||||
) {
|
) {
|
||||||
$types = $request->input('type', []);
|
$types = $request->input('type', []);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class PlayersManagementController extends Controller
|
||||||
public function name(
|
public function name(
|
||||||
Player $player,
|
Player $player,
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher,
|
||||||
) {
|
) {
|
||||||
$name = $request->validate([
|
$name = $request->validate([
|
||||||
'player_name' => [
|
'player_name' => [
|
||||||
|
|
@ -70,7 +70,7 @@ class PlayersManagementController extends Controller
|
||||||
public function owner(
|
public function owner(
|
||||||
Player $player,
|
Player $player,
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher,
|
||||||
) {
|
) {
|
||||||
$uid = $request->validate(['uid' => 'required|integer'])['uid'];
|
$uid = $request->validate(['uid' => 'required|integer'])['uid'];
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ class PlayersManagementController extends Controller
|
||||||
public function texture(
|
public function texture(
|
||||||
Player $player,
|
Player $player,
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher,
|
||||||
) {
|
) {
|
||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
'tid' => 'required|integer',
|
'tid' => 'required|integer',
|
||||||
|
|
@ -123,7 +123,7 @@ class PlayersManagementController extends Controller
|
||||||
|
|
||||||
public function delete(
|
public function delete(
|
||||||
Player $player,
|
Player $player,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher,
|
||||||
) {
|
) {
|
||||||
$dispatcher->dispatch('player.deleting', [$player]);
|
$dispatcher->dispatch('player.deleting', [$player]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class ReportController extends Controller
|
||||||
public function review(
|
public function review(
|
||||||
Report $report,
|
Report $report,
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher,
|
||||||
) {
|
) {
|
||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
'action' => ['required', Rule::in(['delete', 'ban', 'reject'])],
|
'action' => ['required', Rule::in(['delete', 'ban', 'reject'])],
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class SetupController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Filesystem $filesystem,
|
Filesystem $filesystem,
|
||||||
Connection $connection,
|
Connection $connection,
|
||||||
DatabaseManager $manager
|
DatabaseManager $manager,
|
||||||
) {
|
) {
|
||||||
if ($request->isMethod('get')) {
|
if ($request->isMethod('get')) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -121,7 +121,7 @@ class SetupController extends Controller
|
||||||
'database/migrations',
|
'database/migrations',
|
||||||
'vendor/laravel/passport/database/migrations',
|
'vendor/laravel/passport/database/migrations',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$siteUrl = url('/');
|
$siteUrl = url('/');
|
||||||
if (Str::endsWith($siteUrl, '/index.php')) {
|
if (Str::endsWith($siteUrl, '/index.php')) {
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ class SkinlibController extends Controller
|
||||||
public function handleUpload(
|
public function handleUpload(
|
||||||
Request $request,
|
Request $request,
|
||||||
Filter $filter,
|
Filter $filter,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher,
|
||||||
) {
|
) {
|
||||||
$file = $request->file('file');
|
$file = $request->file('file');
|
||||||
if ($file && !$file->isValid()) {
|
if ($file && !$file->isValid()) {
|
||||||
|
|
@ -386,7 +386,7 @@ class SkinlibController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter,
|
Filter $filter,
|
||||||
Texture $texture
|
Texture $texture,
|
||||||
) {
|
) {
|
||||||
$data = $request->validate(['name' => [
|
$data = $request->validate(['name' => [
|
||||||
'required',
|
'required',
|
||||||
|
|
@ -416,7 +416,7 @@ class SkinlibController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter,
|
Filter $filter,
|
||||||
Texture $texture
|
Texture $texture,
|
||||||
) {
|
) {
|
||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
'type' => ['required', Rule::in(['steve', 'alex', 'cape'])],
|
'type' => ['required', Rule::in(['steve', 'alex', 'cape'])],
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class TranslationsController extends Controller
|
||||||
Request $request,
|
Request $request,
|
||||||
Application $app,
|
Application $app,
|
||||||
JavaScript $js,
|
JavaScript $js,
|
||||||
LanguageLine $line
|
LanguageLine $line,
|
||||||
) {
|
) {
|
||||||
$data = $request->validate(['text' => 'required|string']);
|
$data = $request->validate(['text' => 'required|string']);
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ class TranslationsController extends Controller
|
||||||
public function delete(
|
public function delete(
|
||||||
Application $app,
|
Application $app,
|
||||||
JavaScript $js,
|
JavaScript $js,
|
||||||
LanguageLine $line
|
LanguageLine $line,
|
||||||
) {
|
) {
|
||||||
$line->delete();
|
$line->delete();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ use Illuminate\Http\Request;
|
||||||
class CheckRole
|
class CheckRole
|
||||||
{
|
{
|
||||||
protected $roles = [
|
protected $roles = [
|
||||||
'banned' => USER::BANNED,
|
'banned' => User::BANNED,
|
||||||
'normal' => USER::NORMAL,
|
'normal' => User::NORMAL,
|
||||||
'admin' => USER::ADMIN,
|
'admin' => User::ADMIN,
|
||||||
'super-admin' => USER::SUPER_ADMIN,
|
'super-admin' => User::SUPER_ADMIN,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function handle(Request $request, Closure $next, $role)
|
public function handle(Request $request, Closure $next, $role)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class FootComposer
|
||||||
Request $request,
|
Request $request,
|
||||||
JavaScript $javascript,
|
JavaScript $javascript,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter
|
Filter $filter,
|
||||||
) {
|
) {
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
$this->javascript = $javascript;
|
$this->javascript = $javascript;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class HeadComposer
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Request $request,
|
Request $request,
|
||||||
Filter $filter
|
Filter $filter,
|
||||||
) {
|
) {
|
||||||
$this->dispatcher = $dispatcher;
|
$this->dispatcher = $dispatcher;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Events\PlayerProfileUpdated;
|
use App\Events\PlayerProfileUpdated;
|
||||||
use App\Models;
|
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
@ -57,17 +56,17 @@ class Player extends Model
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Models\User::class, 'uid');
|
return $this->belongsTo(User::class, 'uid');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function skin()
|
public function skin()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Models\Texture::class, 'tid_skin');
|
return $this->belongsTo(Texture::class, 'tid_skin');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cape()
|
public function cape()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Models\Texture::class, 'tid_cape');
|
return $this->belongsTo(Texture::class, 'tid_cape');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getModelAttribute()
|
public function getModelAttribute()
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ class OptionForm
|
||||||
/**
|
/**
|
||||||
* Handle the HTTP post request and update modified options.
|
* Handle the HTTP post request and update modified options.
|
||||||
*/
|
*/
|
||||||
public function handle(callable $callback = null): self
|
public function handle(?callable $callback = null): self
|
||||||
{
|
{
|
||||||
$request = request();
|
$request = request();
|
||||||
$allPostData = $request->all();
|
$allPostData = $request->all();
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class PluginManager
|
||||||
Application $app,
|
Application $app,
|
||||||
Option $option,
|
Option $option,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filesystem $filesystem
|
Filesystem $filesystem,
|
||||||
) {
|
) {
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
$this->option = $option;
|
$this->option = $option;
|
||||||
|
|
@ -366,7 +366,7 @@ class PluginManager
|
||||||
*/
|
*/
|
||||||
public function formatUnresolved(
|
public function formatUnresolved(
|
||||||
Collection $unsatisfied,
|
Collection $unsatisfied,
|
||||||
Collection $conflicts
|
Collection $conflicts,
|
||||||
): array {
|
): array {
|
||||||
$unsatisfied = $unsatisfied->map(function ($detail, $name) {
|
$unsatisfied = $unsatisfied->map(function ($detail, $name) {
|
||||||
if ($name === 'blessing-skin-server') {
|
if ($name === 'blessing-skin-server') {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class JavaScript
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Filesystem $filesystem,
|
Filesystem $filesystem,
|
||||||
Repository $cache,
|
Repository $cache,
|
||||||
PluginManager $plugins
|
PluginManager $plugins,
|
||||||
) {
|
) {
|
||||||
$this->filesystem = $filesystem;
|
$this->filesystem = $filesystem;
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class AuthControllerTest extends TestCase
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
app()->instance(Captcha::class, new class() extends Captcha {
|
app()->instance(Captcha::class, new class extends Captcha {
|
||||||
public function passes($attribute, $value)
|
public function passes($attribute, $value)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -35,7 +35,7 @@ class AuthControllerTest extends TestCase
|
||||||
|
|
||||||
public function testLogin()
|
public function testLogin()
|
||||||
{
|
{
|
||||||
$filter = Fakes\Filter::fake();
|
$filter = Filter::fake();
|
||||||
|
|
||||||
$this->get('/auth/login')->assertSee('Log in');
|
$this->get('/auth/login')->assertSee('Log in');
|
||||||
$filter->assertApplied('auth_page_rows:login');
|
$filter->assertApplied('auth_page_rows:login');
|
||||||
|
|
@ -60,28 +60,28 @@ class AuthControllerTest extends TestCase
|
||||||
// Should return a warning if length of `password` is lower than 6
|
// Should return a warning if length of `password` is lower than 6
|
||||||
$this->postJson(
|
$this->postJson(
|
||||||
'/auth/login', [
|
'/auth/login', [
|
||||||
'identification' => $user->email,
|
'identification' => $user->email,
|
||||||
'password' => '123',
|
'password' => '123',
|
||||||
])->assertJsonValidationErrors('password');
|
])->assertJsonValidationErrors('password');
|
||||||
|
|
||||||
// Should return a warning if length of `password` is greater than 32
|
// Should return a warning if length of `password` is greater than 32
|
||||||
$this->postJson(
|
$this->postJson(
|
||||||
'/auth/login', [
|
'/auth/login', [
|
||||||
'identification' => $user->email,
|
'identification' => $user->email,
|
||||||
'password' => Str::random(80),
|
'password' => Str::random(80),
|
||||||
])->assertJsonValidationErrors('password');
|
])->assertJsonValidationErrors('password');
|
||||||
|
|
||||||
$this->flushSession();
|
$this->flushSession();
|
||||||
|
|
||||||
// Should return a warning if user isn't existed
|
// Should return a warning if user isn't existed
|
||||||
$this->postJson(
|
$this->postJson(
|
||||||
'/auth/login', [
|
'/auth/login', [
|
||||||
'identification' => 'nope@nope.net',
|
'identification' => 'nope@nope.net',
|
||||||
'password' => '12345678',
|
'password' => '12345678',
|
||||||
])->assertJson([
|
])->assertJson([
|
||||||
'code' => 2,
|
'code' => 2,
|
||||||
'message' => trans('auth.validation.user'),
|
'message' => trans('auth.validation.user'),
|
||||||
]);
|
]);
|
||||||
Event::assertDispatched('auth.login.attempt', function ($event, $payload) {
|
Event::assertDispatched('auth.login.attempt', function ($event, $payload) {
|
||||||
$this->assertEquals('nope@nope.net', $payload[0]);
|
$this->assertEquals('nope@nope.net', $payload[0]);
|
||||||
$this->assertEquals('12345678', $payload[1]);
|
$this->assertEquals('12345678', $payload[1]);
|
||||||
|
|
@ -103,15 +103,15 @@ class AuthControllerTest extends TestCase
|
||||||
// Logging in should be failed if password is wrong
|
// Logging in should be failed if password is wrong
|
||||||
$this->postJson(
|
$this->postJson(
|
||||||
'/auth/login', [
|
'/auth/login', [
|
||||||
'identification' => $user->email,
|
'identification' => $user->email,
|
||||||
'password' => 'wrong-password',
|
'password' => 'wrong-password',
|
||||||
])->assertJson(
|
])->assertJson(
|
||||||
[
|
[
|
||||||
'code' => 1,
|
'code' => 1,
|
||||||
'message' => trans('auth.validation.password'),
|
'message' => trans('auth.validation.password'),
|
||||||
'data' => ['login_fails' => 1],
|
'data' => ['login_fails' => 1],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$filter->assertApplied('client_ip', function ($value) use ($ip) {
|
$filter->assertApplied('client_ip', function ($value) use ($ip) {
|
||||||
$this->assertEquals($ip, $value);
|
$this->assertEquals($ip, $value);
|
||||||
|
|
||||||
|
|
@ -143,8 +143,8 @@ class AuthControllerTest extends TestCase
|
||||||
Cache::put($loginFailsCacheKey, 4);
|
Cache::put($loginFailsCacheKey, 4);
|
||||||
$this->postJson(
|
$this->postJson(
|
||||||
'/auth/login', [
|
'/auth/login', [
|
||||||
'identification' => $user->email,
|
'identification' => $user->email,
|
||||||
'password' => '12345678',
|
'password' => '12345678',
|
||||||
])->assertJsonValidationErrors('captcha');
|
])->assertJsonValidationErrors('captcha');
|
||||||
|
|
||||||
Cache::flush();
|
Cache::flush();
|
||||||
|
|
@ -183,9 +183,9 @@ class AuthControllerTest extends TestCase
|
||||||
auth()->logout();
|
auth()->logout();
|
||||||
$this->postJson(
|
$this->postJson(
|
||||||
'/auth/login', [
|
'/auth/login', [
|
||||||
'identification' => $player->name,
|
'identification' => $player->name,
|
||||||
'password' => '12345678',
|
'password' => '12345678',
|
||||||
]
|
]
|
||||||
)->assertJson(
|
)->assertJson(
|
||||||
[
|
[
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
|
|
@ -240,7 +240,7 @@ class AuthControllerTest extends TestCase
|
||||||
|
|
||||||
public function testRegister()
|
public function testRegister()
|
||||||
{
|
{
|
||||||
$filter = Fakes\Filter::fake();
|
$filter = Filter::fake();
|
||||||
|
|
||||||
$this->get('/auth/register')->assertSee('Register');
|
$this->get('/auth/register')->assertSee('Register');
|
||||||
$filter->assertApplied('auth_page_rows:register');
|
$filter->assertApplied('auth_page_rows:register');
|
||||||
|
|
|
||||||
|
|
@ -41,20 +41,20 @@ class ClosetControllerTest extends TestCase
|
||||||
$user->closet()->attach($cape->tid, ['item_name' => 'custom_name']);
|
$user->closet()->attach($cape->tid, ['item_name' => 'custom_name']);
|
||||||
$this->getJson('/user/closet/list?category=cape')
|
$this->getJson('/user/closet/list?category=cape')
|
||||||
->assertJson(['data' => [[
|
->assertJson(['data' => [[
|
||||||
'tid' => $cape->tid,
|
'tid' => $cape->tid,
|
||||||
'type' => 'cape',
|
'type' => 'cape',
|
||||||
'pivot' => ['item_name' => 'custom_name'],
|
'pivot' => ['item_name' => 'custom_name'],
|
||||||
],
|
],
|
||||||
]]);
|
]]);
|
||||||
|
|
||||||
// Search by keyword
|
// Search by keyword
|
||||||
$random = $textures->random();
|
$random = $textures->random();
|
||||||
$this->getJson('/user/closet/list?q='.$random->name)
|
$this->getJson('/user/closet/list?q='.$random->name)
|
||||||
->assertJson(['data' => [[
|
->assertJson(['data' => [[
|
||||||
'tid' => $random->tid,
|
'tid' => $random->tid,
|
||||||
'name' => $random->name,
|
'name' => $random->name,
|
||||||
'type' => $random->type,
|
'type' => $random->type,
|
||||||
],
|
],
|
||||||
]]);
|
]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -430,13 +430,13 @@ class PlayerControllerTest extends TestCase
|
||||||
|
|
||||||
// success
|
// success
|
||||||
$this->deleteJson(route('user.player.clear', ['player' => $player]), [
|
$this->deleteJson(route('user.player.clear', ['player' => $player]), [
|
||||||
'skin' => true,
|
'skin' => true,
|
||||||
'cape' => true,
|
'cape' => true,
|
||||||
'nope' => true, // invalid texture type is acceptable
|
'nope' => true, // invalid texture type is acceptable
|
||||||
])->assertJson([
|
])->assertJson([
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
'message' => trans('user.player.clear.success', ['name' => $player->name]),
|
'message' => trans('user.player.clear.success', ['name' => $player->name]),
|
||||||
]);
|
]);
|
||||||
$this->assertEquals(0, Player::find($player->pid)->tid_skin);
|
$this->assertEquals(0, Player::find($player->pid)->tid_skin);
|
||||||
$this->assertEquals(0, Player::find($player->pid)->tid_cape);
|
$this->assertEquals(0, Player::find($player->pid)->tid_cape);
|
||||||
Event::assertDispatched(Events\PlayerProfileUpdated::class);
|
Event::assertDispatched(Events\PlayerProfileUpdated::class);
|
||||||
|
|
|
||||||
|
|
@ -480,15 +480,15 @@ class SkinlibControllerTest extends TestCase
|
||||||
$texture->uploader = $user->uid;
|
$texture->uploader = $user->uid;
|
||||||
$texture->save();
|
$texture->save();
|
||||||
$this->postJson(route('texture.upload'), [
|
$this->postJson(route('texture.upload'), [
|
||||||
'name' => 'texture',
|
'name' => 'texture',
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'type' => 'steve',
|
'type' => 'steve',
|
||||||
'file' => $upload,
|
'file' => $upload,
|
||||||
])->assertJson([
|
])->assertJson([
|
||||||
'code' => 2,
|
'code' => 2,
|
||||||
'message' => trans('skinlib.upload.repeated'),
|
'message' => trans('skinlib.upload.repeated'),
|
||||||
'data' => ['tid' => $texture->tid],
|
'data' => ['tid' => $texture->tid],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// rejected
|
// rejected
|
||||||
$filter->add('can_upload_texture', function ($can, $file, $name) {
|
$filter->add('can_upload_texture', function ($can, $file, $name) {
|
||||||
|
|
@ -498,11 +498,11 @@ class SkinlibControllerTest extends TestCase
|
||||||
return new Rejection('rejected');
|
return new Rejection('rejected');
|
||||||
});
|
});
|
||||||
$this->postJson(route('texture.upload'), [
|
$this->postJson(route('texture.upload'), [
|
||||||
'name' => 'texture',
|
'name' => 'texture',
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'type' => 'steve',
|
'type' => 'steve',
|
||||||
'file' => $upload,
|
'file' => $upload,
|
||||||
])->assertJson(['code' => 1, 'message' => 'rejected']);
|
])->assertJson(['code' => 1, 'message' => 'rejected']);
|
||||||
|
|
||||||
$disk->delete($texture->hash);
|
$disk->delete($texture->hash);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -489,12 +489,12 @@ class UserControllerTest extends TestCase
|
||||||
// Administrator cannot be deleted
|
// Administrator cannot be deleted
|
||||||
$this->actingAs(User::factory()->admin()->create())
|
$this->actingAs(User::factory()->admin()->create())
|
||||||
->postJson('/user/profile', [
|
->postJson('/user/profile', [
|
||||||
'action' => 'delete',
|
'action' => 'delete',
|
||||||
'password' => '87654321',
|
'password' => '87654321',
|
||||||
])->assertJson([
|
])->assertJson([
|
||||||
'code' => 1,
|
'code' => 1,
|
||||||
'message' => trans('user.profile.delete.admin'),
|
'message' => trans('user.profile.delete.admin'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetAvatar()
|
public function testSetAvatar()
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,7 @@ class PluginManagerTest extends TestCase
|
||||||
->with('/mayaka/callbacks.php')
|
->with('/mayaka/callbacks.php')
|
||||||
->once()
|
->once()
|
||||||
->andReturn([
|
->andReturn([
|
||||||
\App\Events\PluginWasDeleted::class => function ($plugin) {
|
Events\PluginWasDeleted::class => function ($plugin) {
|
||||||
$this->assertInstanceOf(Plugin::class, $plugin);
|
$this->assertInstanceOf(Plugin::class, $plugin);
|
||||||
$this->assertEquals('mayaka', $plugin->name);
|
$this->assertEquals('mayaka', $plugin->name);
|
||||||
},
|
},
|
||||||
|
|
@ -434,7 +434,7 @@ class PluginManagerTest extends TestCase
|
||||||
|
|
||||||
app()->forgetInstance(PluginManager::class);
|
app()->forgetInstance(PluginManager::class);
|
||||||
resolve(PluginManager::class)->boot();
|
resolve(PluginManager::class)->boot();
|
||||||
event(new \App\Events\PluginWasDeleted(new Plugin('/mayaka', ['name' => 'mayaka'])));
|
event(new Events\PluginWasDeleted(new Plugin('/mayaka', ['name' => 'mayaka'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRegisterAutoload()
|
public function testRegisterAutoload()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user