Refactor tests

This commit is contained in:
Pig Fang 2019-04-04 09:50:48 +08:00
parent 3fc7dc6a21
commit c5eefbd061
7 changed files with 58 additions and 58 deletions

View File

@ -550,7 +550,7 @@ class AdminControllerTest extends BrowserKitTestCase
'msg' => trans('admin.players.no-permission'), 'msg' => trans('admin.players.no-permission'),
]); ]);
// For self is OK // For self is OK
$this->actAs($admin)->postJson( $this->actingAs($admin)->postJson(
'/admin/players', '/admin/players',
['pid' => factory(Player::class)->create(['uid' => $admin->uid])->pid] ['pid' => factory(Player::class)->create(['uid' => $admin->uid])->pid]
)->seeJson([ )->seeJson([

View File

@ -19,7 +19,7 @@ class ClosetControllerTest extends TestCase
{ {
parent::setUp(); parent::setUp();
$this->user = factory(User::class)->create(); $this->user = factory(User::class)->create();
$this->actAs($this->user); $this->actingAs($this->user);
} }
public function testIndex() public function testIndex()

View File

@ -143,7 +143,7 @@ class MiddlewareTest extends TestCase
$player = factory(\App\Models\Player::class)->create(); $player = factory(\App\Models\Player::class)->create();
$user = $player->user; $user = $player->user;
$this->actAs($user) $this->actingAs($user)
->postJson('/user/player/rename', [ ->postJson('/user/player/rename', [
'pid' => -1, 'pid' => -1,
'new_player_name' => 'name', 'new_player_name' => 'name',
@ -151,7 +151,7 @@ class MiddlewareTest extends TestCase
'errno' => 1, 'errno' => 1,
'msg' => trans('general.unexistent-player'), 'msg' => trans('general.unexistent-player'),
]); ]);
$this->actAs($user) $this->actingAs($user)
->postJson('/user/player/rename', [ ->postJson('/user/player/rename', [
'pid' => $player->pid, 'pid' => $player->pid,
'new_player_name' => 'name', 'new_player_name' => 'name',
@ -166,11 +166,11 @@ class MiddlewareTest extends TestCase
$player = factory(\App\Models\Player::class)->create(); $player = factory(\App\Models\Player::class)->create();
$owner = $player->user; $owner = $player->user;
$this->actAs($other_user) $this->actingAs($other_user)
->get('/user/player') ->get('/user/player')
->assertSuccessful(); ->assertSuccessful();
$this->actAs($other_user) $this->actingAs($other_user)
->postJson('/user/player/rename', [ ->postJson('/user/player/rename', [
'pid' => $player->pid, 'pid' => $player->pid,
])->assertJson([ ])->assertJson([
@ -178,7 +178,7 @@ class MiddlewareTest extends TestCase
'msg' => trans('admin.players.no-permission'), 'msg' => trans('admin.players.no-permission'),
]); ]);
$this->actAs($owner) $this->actingAs($owner)
->postJson('/user/player/rename', [ ->postJson('/user/player/rename', [
'pid' => $player->pid, 'pid' => $player->pid,
'new_player_name' => 'name', 'new_player_name' => 'name',
@ -201,7 +201,7 @@ class MiddlewareTest extends TestCase
public function testRequireBindPlayer() public function testRequireBindPlayer()
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
$this->actAs($user)->get('/user')->assertViewIs('user.index'); $this->actingAs($user)->get('/user')->assertViewIs('user.index');
$this->get('/user/player/bind')->assertRedirect('/user'); $this->get('/user/player/bind')->assertRedirect('/user');
option(['single_player' => true]); option(['single_player' => true]);

View File

@ -71,7 +71,7 @@ class PlayerControllerTest extends TestCase
// Lack of score // Lack of score
option(['player_name_rule' => 'official']); option(['player_name_rule' => 'official']);
$user = factory(User::class)->create(['score' => 0]); $user = factory(User::class)->create(['score' => 0]);
$this->actAs($user)->postJson( $this->actingAs($user)->postJson(
'/user/player/add', '/user/player/add',
['player_name' => 'no_score'] ['player_name' => 'no_score']
)->assertJson([ )->assertJson([
@ -84,7 +84,7 @@ class PlayerControllerTest extends TestCase
option(['player_name_rule' => 'cjk']); option(['player_name_rule' => 'cjk']);
$user = factory(User::class)->create(); $user = factory(User::class)->create();
$score = $user->score; $score = $user->score;
$this->actAs($user)->postJson('/user/player/add', [ $this->actingAs($user)->postJson('/user/player/add', [
'player_name' => '角色名', 'player_name' => '角色名',
])->assertJson([ ])->assertJson([
'errno' => 0, 'errno' => 0,
@ -177,7 +177,7 @@ class PlayerControllerTest extends TestCase
$user = $player->user; $user = $player->user;
// Without new player name // Without new player name
$this->actAs($user) $this->actingAs($user)
->postJson('/user/player/rename', [ ->postJson('/user/player/rename', [
'pid' => $player->pid, 'pid' => $player->pid,
]) ])
@ -247,7 +247,7 @@ class PlayerControllerTest extends TestCase
$cape = factory(Texture::class, 'cape')->create(); $cape = factory(Texture::class, 'cape')->create();
// Set a not-existed texture // Set a not-existed texture
$this->actAs($user) $this->actingAs($user)
->postJson('/user/player/set', [ ->postJson('/user/player/set', [
'pid' => $player->pid, 'pid' => $player->pid,
'tid' => ['skin' => -1], 'tid' => ['skin' => -1],
@ -297,7 +297,7 @@ class PlayerControllerTest extends TestCase
$player->save(); $player->save();
$player->refresh(); $player->refresh();
$this->actAs($user) $this->actingAs($user)
->postJson('/user/player/texture/clear', [ ->postJson('/user/player/texture/clear', [
'pid' => $player->pid, 'pid' => $player->pid,
'skin' => 1, // "1" stands for "true" 'skin' => 1, // "1" stands for "true"
@ -318,7 +318,7 @@ class PlayerControllerTest extends TestCase
option(['single_player' => true]); option(['single_player' => true]);
$user = factory(User::class)->create(); $user = factory(User::class)->create();
$this->actAs($user)->postJson('/user/player/bind') $this->actingAs($user)->postJson('/user/player/bind')
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
'msg' => trans('validation.required', ['attribute' => 'player']), 'msg' => trans('validation.required', ['attribute' => 'player']),

View File

@ -17,7 +17,7 @@ class ReportControllerTest extends TestCase
$texture = factory(Texture::class)->create(); $texture = factory(Texture::class)->create();
// Without `tid` field // Without `tid` field
$this->actAs($user) $this->actingAs($user)
->postJson('/skinlib/report') ->postJson('/skinlib/report')
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -82,7 +82,7 @@ class ReportControllerTest extends TestCase
$report->status = Report::PENDING; $report->status = Report::PENDING;
$report->save(); $report->save();
$this->actAs($user) $this->actingAs($user)
->getJson('/user/report-list') ->getJson('/user/report-list')
->assertJson([[ ->assertJson([[
'tid' => 1, 'tid' => 1,
@ -105,7 +105,7 @@ class ReportControllerTest extends TestCase
$report->status = Report::PENDING; $report->status = Report::PENDING;
$report->save(); $report->save();
$this->actAs($reporter) $this->actingAs($reporter)
->getJson('/admin/report-data') ->getJson('/admin/report-data')
->assertJson([ ->assertJson([
'totalRecords' => 1, 'totalRecords' => 1,
@ -137,7 +137,7 @@ class ReportControllerTest extends TestCase
$report->refresh(); $report->refresh();
// Without `id` field // Without `id` field
$this->actAs($reporter) $this->actingAs($reporter)
->postJson('/admin/reports') ->postJson('/admin/reports')
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,

View File

@ -229,7 +229,7 @@ class SkinlibControllerTest extends TestCase
})); }));
// Other users should not see someone's private textures // Other users should not see someone's private textures
$items = $this->actAs($otherUser) $items = $this->actingAs($otherUser)
->getJson('/skinlib/data') ->getJson('/skinlib/data')
->assertJson([ ->assertJson([
'current_uid' => $otherUser->uid, 'current_uid' => $otherUser->uid,
@ -253,7 +253,7 @@ class SkinlibControllerTest extends TestCase
]); ]);
// Uploader can see his private textures // Uploader can see his private textures
$items = $this->actAs($uploader) $items = $this->actingAs($uploader)
->getJson('/skinlib/data') ->getJson('/skinlib/data')
->assertJson([ ->assertJson([
'current_uid' => $uploader->uid, 'current_uid' => $uploader->uid,
@ -266,7 +266,7 @@ class SkinlibControllerTest extends TestCase
// Administrators can see private textures // Administrators can see private textures
$admin = factory(User::class, 'admin')->create(); $admin = factory(User::class, 'admin')->create();
$items = $this->actAs($admin) $items = $this->actingAs($admin)
->getJson('/skinlib/data') ->getJson('/skinlib/data')
->assertJson([ ->assertJson([
'current_uid' => $admin->uid, 'current_uid' => $admin->uid,
@ -327,7 +327,7 @@ class SkinlibControllerTest extends TestCase
->assertViewHas('texture'); ->assertViewHas('texture');
// Uploader should be able to see private textures // Uploader should be able to see private textures
$this->actAs($uploader) $this->actingAs($uploader)
->get('/skinlib/show/'.$texture->tid) ->get('/skinlib/show/'.$texture->tid)
->assertViewHas('texture'); ->assertViewHas('texture');
} }
@ -524,7 +524,7 @@ class SkinlibControllerTest extends TestCase
// Score is not enough // Score is not enough
$user = factory(User::class)->create(['score' => 0]); $user = factory(User::class)->create(['score' => 0]);
$this->actAs($user) $this->actingAs($user)
->postJson( ->postJson(
'/skinlib/upload', '/skinlib/upload',
[ [
@ -542,7 +542,7 @@ class SkinlibControllerTest extends TestCase
$user = factory(User::class)->create([ $user = factory(User::class)->create([
'score' => (int) option('score_per_closet_item') + (int) option('score_per_storage'), 'score' => (int) option('score_per_closet_item') + (int) option('score_per_storage'),
]); ]);
$this->actAs($user)->postJson( $this->actingAs($user)->postJson(
'/skinlib/upload', '/skinlib/upload',
[ [
'name' => 'texture', 'name' => 'texture',
@ -584,7 +584,7 @@ class SkinlibControllerTest extends TestCase
// Upload a duplicated texture // Upload a duplicated texture
$user = factory(User::class)->create(); $user = factory(User::class)->create();
$this->actAs($user) $this->actingAs($user)
->postJson( ->postJson(
'/skinlib/upload', '/skinlib/upload',
[ [
@ -610,7 +610,7 @@ class SkinlibControllerTest extends TestCase
option(['return_score' => false]); option(['return_score' => false]);
// Non-existed texture // Non-existed texture
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/delete', ['tid' => -1]) ->postJson('/skinlib/delete', ['tid' => -1])
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -618,7 +618,7 @@ class SkinlibControllerTest extends TestCase
]); ]);
// Other user should not be able to delete // Other user should not be able to delete
$this->actAs($other) $this->actingAs($other)
->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->postJson('/skinlib/delete', ['tid' => $texture->tid])
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -660,7 +660,7 @@ class SkinlibControllerTest extends TestCase
// Return score // Return score
option(['return_score' => true]); option(['return_score' => true]);
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->postJson('/skinlib/delete', ['tid' => $texture->tid])
->assertJson([ ->assertJson([
'errno' => 0, 'errno' => 0,
@ -676,7 +676,7 @@ class SkinlibControllerTest extends TestCase
'uploader' => $uploader->uid, 'uploader' => $uploader->uid,
'public' => false, 'public' => false,
]); ]);
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->postJson('/skinlib/delete', ['tid' => $texture->tid])
->assertJson([ ->assertJson([
'errno' => 0, 'errno' => 0,
@ -693,7 +693,7 @@ class SkinlibControllerTest extends TestCase
option(['score_award_per_texture' => 5]); option(['score_award_per_texture' => 5]);
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
$uploader->refresh(); $uploader->refresh();
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->postJson('/skinlib/delete', ['tid' => $texture->tid])
->assertJson(['errno' => 0]); ->assertJson(['errno' => 0]);
$this->assertEquals($uploader->score - 5, User::find($uploader->uid)->score); $this->assertEquals($uploader->score - 5, User::find($uploader->uid)->score);
@ -701,7 +701,7 @@ class SkinlibControllerTest extends TestCase
option(['take_back_scores_after_deletion' => false]); option(['take_back_scores_after_deletion' => false]);
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
$uploader->refresh(); $uploader->refresh();
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->postJson('/skinlib/delete', ['tid' => $texture->tid])
->assertJson(['errno' => 0]); ->assertJson(['errno' => 0]);
$this->assertEquals($uploader->score, User::find($uploader->uid)->score); $this->assertEquals($uploader->score, User::find($uploader->uid)->score);
@ -711,7 +711,7 @@ class SkinlibControllerTest extends TestCase
'public' => false 'public' => false
]); ]);
$uploader->refresh(); $uploader->refresh();
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->postJson('/skinlib/delete', ['tid' => $texture->tid])
->assertJson(['errno' => 0]); ->assertJson(['errno' => 0]);
$this->assertEquals($uploader->score, User::find($uploader->uid)->score); $this->assertEquals($uploader->score, User::find($uploader->uid)->score);
@ -722,7 +722,7 @@ class SkinlibControllerTest extends TestCase
$other->closet()->attach($texture->tid, ['item_name' => 'a']); $other->closet()->attach($texture->tid, ['item_name' => 'a']);
$other->score = 0; $other->score = 0;
$other->save(); $other->save();
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->postJson('/skinlib/delete', ['tid' => $texture->tid])
->assertJson(['errno' => 0]); ->assertJson(['errno' => 0]);
$other->refresh(); $other->refresh();
@ -736,7 +736,7 @@ class SkinlibControllerTest extends TestCase
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
// Non-existed texture // Non-existed texture
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/privacy', ['tid' => -1]) ->postJson('/skinlib/privacy', ['tid' => -1])
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -744,7 +744,7 @@ class SkinlibControllerTest extends TestCase
]); ]);
// Other user should not be able to set privacy // Other user should not be able to set privacy
$this->actAs($other) $this->actingAs($other)
->postJson('/skinlib/privacy', ['tid' => $texture->tid]) ->postJson('/skinlib/privacy', ['tid' => $texture->tid])
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -767,7 +767,7 @@ class SkinlibControllerTest extends TestCase
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
$uploader->score = 0; $uploader->score = 0;
$uploader->save(); $uploader->save();
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/privacy', ['tid' => $texture->tid]) ->postJson('/skinlib/privacy', ['tid' => $texture->tid])
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -841,7 +841,7 @@ class SkinlibControllerTest extends TestCase
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
// Without `tid` field // Without `tid` field
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/rename') ->postJson('/skinlib/rename')
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -887,7 +887,7 @@ class SkinlibControllerTest extends TestCase
]); ]);
// Other user should not be able to rename // Other user should not be able to rename
$this->actAs($other) $this->actingAs($other)
->postJson('/skinlib/rename', [ ->postJson('/skinlib/rename', [
'tid' => $texture->tid, 'tid' => $texture->tid,
'new_name' => 'name', 'new_name' => 'name',
@ -910,7 +910,7 @@ class SkinlibControllerTest extends TestCase
$this->assertEquals('name', Texture::find($texture->tid)->name); $this->assertEquals('name', Texture::find($texture->tid)->name);
// Uploader should be able to rename // Uploader should be able to rename
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/rename', [ ->postJson('/skinlib/rename', [
'tid' => $texture->tid, 'tid' => $texture->tid,
'new_name' => 'new_name', 'new_name' => 'new_name',
@ -929,7 +929,7 @@ class SkinlibControllerTest extends TestCase
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
// Non-existed texture // Non-existed texture
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/model', [ ->postJson('/skinlib/model', [
'tid' => -1, 'tid' => -1,
'model' => 'alex', 'model' => 'alex',
@ -940,7 +940,7 @@ class SkinlibControllerTest extends TestCase
]); ]);
// Other user should not be able to change model // Other user should not be able to change model
$this->actAs($other) $this->actingAs($other)
->postJson('/skinlib/model', [ ->postJson('/skinlib/model', [
'tid' => $texture->tid, 'tid' => $texture->tid,
'model' => 'alex', 'model' => 'alex',
@ -963,7 +963,7 @@ class SkinlibControllerTest extends TestCase
$this->assertEquals('alex', Texture::find($texture->tid)->type); $this->assertEquals('alex', Texture::find($texture->tid)->type);
// Uploader should be able to change model // Uploader should be able to change model
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/model', [ ->postJson('/skinlib/model', [
'tid' => $texture->tid, 'tid' => $texture->tid,
'model' => 'steve', 'model' => 'steve',
@ -980,7 +980,7 @@ class SkinlibControllerTest extends TestCase
]); ]);
// Should fail if there is already a texture with same hash and chosen model // Should fail if there is already a texture with same hash and chosen model
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/model', [ ->postJson('/skinlib/model', [
'tid' => $texture->tid, 'tid' => $texture->tid,
'model' => 'alex', 'model' => 'alex',
@ -993,7 +993,7 @@ class SkinlibControllerTest extends TestCase
// Allow private texture // Allow private texture
$duplicate->public = false; $duplicate->public = false;
$duplicate->save(); $duplicate->save();
$this->actAs($uploader) $this->actingAs($uploader)
->postJson('/skinlib/model', [ ->postJson('/skinlib/model', [
'tid' => $texture->tid, 'tid' => $texture->tid,
'model' => 'alex', 'model' => 'alex',

View File

@ -19,14 +19,14 @@ class UserControllerTest extends TestCase
$user = factory(User::class)->create(); $user = factory(User::class)->create();
factory(\App\Models\Player::class)->create(['uid' => $user->uid]); factory(\App\Models\Player::class)->create(['uid' => $user->uid]);
$this->actAs($user) $this->actingAs($user)
->get('/user') ->get('/user')
->assertViewHas('statistics') ->assertViewHas('statistics')
->assertSee((new Parsedown())->text(option_localized('announcement'))) ->assertSee((new Parsedown())->text(option_localized('announcement')))
->assertSee((string) $user->score); ->assertSee((string) $user->score);
$unverified = factory(User::class)->create(['verified' => false]); $unverified = factory(User::class)->create(['verified' => false]);
$this->actAs($unverified) $this->actingAs($unverified)
->get('/user') ->get('/user')
->assertDontSee(trans('user.verification.notice.title')); ->assertDontSee(trans('user.verification.notice.title'));
} }
@ -66,7 +66,7 @@ class UserControllerTest extends TestCase
$user = factory(User::class)->create(); $user = factory(User::class)->create();
// Success // Success
$this->actAs($user) $this->actingAs($user)
->postJson('/user/sign') ->postJson('/user/sign')
->assertJson([ ->assertJson([
'errno' => 0, 'errno' => 0,
@ -83,7 +83,7 @@ class UserControllerTest extends TestCase
// Remaining time is greater than 0 // Remaining time is greater than 0
$user = factory(User::class)->create(['last_sign_at' => get_datetime_string()]); $user = factory(User::class)->create(['last_sign_at' => get_datetime_string()]);
option(['sign_gap_time' => 2]); option(['sign_gap_time' => 2]);
$this->actAs($user) $this->actingAs($user)
->postJson('/user/sign') ->postJson('/user/sign')
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -107,7 +107,7 @@ class UserControllerTest extends TestCase
$diff = round($diff / 60); $diff = round($diff / 60);
$unit = 'min'; $unit = 'min';
} }
$this->actAs($user) $this->actingAs($user)
->postJson('/user/sign') ->postJson('/user/sign')
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -123,7 +123,7 @@ class UserControllerTest extends TestCase
$user = factory(User::class)->create([ $user = factory(User::class)->create([
'last_sign_at' => \Carbon\Carbon::today()->toDateTimeString(), 'last_sign_at' => \Carbon\Carbon::today()->toDateTimeString(),
]); ]);
$this->actAs($user)->postJson('/user/sign') $this->actingAs($user)->postJson('/user/sign')
->assertJson([ ->assertJson([
'errno' => 0, 'errno' => 0,
]); ]);
@ -208,7 +208,7 @@ class UserControllerTest extends TestCase
$user->changePassword('12345678'); $user->changePassword('12345678');
// Invalid action // Invalid action
$this->actAs($user) $this->actingAs($user)
->postJson('/user/profile') ->postJson('/user/profile')
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -331,7 +331,7 @@ class UserControllerTest extends TestCase
$user = User::find($user->uid); $user = User::find($user->uid);
// Change email without `new_email` field // Change email without `new_email` field
$this->actAs($user) $this->actingAs($user)
->postJson( ->postJson(
'/user/profile', '/user/profile',
['action' => 'email'] ['action' => 'email']
@ -408,7 +408,7 @@ class UserControllerTest extends TestCase
$user->verified = true; $user->verified = true;
$user->save(); $user->save();
// Delete account without `password` field // Delete account without `password` field
$this->actAs($user) $this->actingAs($user)
->postJson( ->postJson(
'/user/profile', '/user/profile',
['action' => 'delete'] ['action' => 'delete']
@ -473,7 +473,7 @@ class UserControllerTest extends TestCase
$cape = factory(\App\Models\Texture::class, 'cape')->create(); $cape = factory(\App\Models\Texture::class, 'cape')->create();
// Without `tid` field // Without `tid` field
$this->actAs($user) $this->actingAs($user)
->postJson('/user/profile/avatar') ->postJson('/user/profile/avatar')
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -481,7 +481,7 @@ class UserControllerTest extends TestCase
]); ]);
// TID is not a integer // TID is not a integer
$this->actAs($user) $this->actingAs($user)
->postJson('/user/profile/avatar', ['tid' => 'string']) ->postJson('/user/profile/avatar', ['tid' => 'string'])
->assertJson([ ->assertJson([
'errno' => 1, 'errno' => 1,
@ -489,7 +489,7 @@ class UserControllerTest extends TestCase
]); ]);
// Texture cannot be found // Texture cannot be found
$this->actAs($user) $this->actingAs($user)
->postJson('/user/profile/avatar', [ ->postJson('/user/profile/avatar', [
'tid' => -1, 'tid' => -1,
]) ])
@ -499,7 +499,7 @@ class UserControllerTest extends TestCase
]); ]);
// Use cape // Use cape
$this->actAs($user) $this->actingAs($user)
->postJson('/user/profile/avatar', [ ->postJson('/user/profile/avatar', [
'tid' => $cape->tid, 'tid' => $cape->tid,
]) ])
@ -509,7 +509,7 @@ class UserControllerTest extends TestCase
]); ]);
// Success // Success
$this->actAs($user) $this->actingAs($user)
->postJson('/user/profile/avatar', [ ->postJson('/user/profile/avatar', [
'tid' => $steve->tid, 'tid' => $steve->tid,
]) ])