diff --git a/tests/AdminControllerTest.php b/tests/AdminControllerTest.php index dd3a41be..71d9ae20 100644 --- a/tests/AdminControllerTest.php +++ b/tests/AdminControllerTest.php @@ -550,7 +550,7 @@ class AdminControllerTest extends BrowserKitTestCase 'msg' => trans('admin.players.no-permission'), ]); // For self is OK - $this->actAs($admin)->postJson( + $this->actingAs($admin)->postJson( '/admin/players', ['pid' => factory(Player::class)->create(['uid' => $admin->uid])->pid] )->seeJson([ diff --git a/tests/ClosetControllerTest.php b/tests/ClosetControllerTest.php index 9bbcc4f7..e89fadfd 100644 --- a/tests/ClosetControllerTest.php +++ b/tests/ClosetControllerTest.php @@ -19,7 +19,7 @@ class ClosetControllerTest extends TestCase { parent::setUp(); $this->user = factory(User::class)->create(); - $this->actAs($this->user); + $this->actingAs($this->user); } public function testIndex() diff --git a/tests/MiddlewareTest.php b/tests/MiddlewareTest.php index 471eacdb..2b2e36f4 100644 --- a/tests/MiddlewareTest.php +++ b/tests/MiddlewareTest.php @@ -143,7 +143,7 @@ class MiddlewareTest extends TestCase $player = factory(\App\Models\Player::class)->create(); $user = $player->user; - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/player/rename', [ 'pid' => -1, 'new_player_name' => 'name', @@ -151,7 +151,7 @@ class MiddlewareTest extends TestCase 'errno' => 1, 'msg' => trans('general.unexistent-player'), ]); - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/player/rename', [ 'pid' => $player->pid, 'new_player_name' => 'name', @@ -166,11 +166,11 @@ class MiddlewareTest extends TestCase $player = factory(\App\Models\Player::class)->create(); $owner = $player->user; - $this->actAs($other_user) + $this->actingAs($other_user) ->get('/user/player') ->assertSuccessful(); - $this->actAs($other_user) + $this->actingAs($other_user) ->postJson('/user/player/rename', [ 'pid' => $player->pid, ])->assertJson([ @@ -178,7 +178,7 @@ class MiddlewareTest extends TestCase 'msg' => trans('admin.players.no-permission'), ]); - $this->actAs($owner) + $this->actingAs($owner) ->postJson('/user/player/rename', [ 'pid' => $player->pid, 'new_player_name' => 'name', @@ -201,7 +201,7 @@ class MiddlewareTest extends TestCase public function testRequireBindPlayer() { $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'); option(['single_player' => true]); diff --git a/tests/PlayerControllerTest.php b/tests/PlayerControllerTest.php index 5a40240e..95fb649e 100644 --- a/tests/PlayerControllerTest.php +++ b/tests/PlayerControllerTest.php @@ -71,7 +71,7 @@ class PlayerControllerTest extends TestCase // Lack of score option(['player_name_rule' => 'official']); $user = factory(User::class)->create(['score' => 0]); - $this->actAs($user)->postJson( + $this->actingAs($user)->postJson( '/user/player/add', ['player_name' => 'no_score'] )->assertJson([ @@ -84,7 +84,7 @@ class PlayerControllerTest extends TestCase option(['player_name_rule' => 'cjk']); $user = factory(User::class)->create(); $score = $user->score; - $this->actAs($user)->postJson('/user/player/add', [ + $this->actingAs($user)->postJson('/user/player/add', [ 'player_name' => '角色名', ])->assertJson([ 'errno' => 0, @@ -177,7 +177,7 @@ class PlayerControllerTest extends TestCase $user = $player->user; // Without new player name - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/player/rename', [ 'pid' => $player->pid, ]) @@ -247,7 +247,7 @@ class PlayerControllerTest extends TestCase $cape = factory(Texture::class, 'cape')->create(); // Set a not-existed texture - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/player/set', [ 'pid' => $player->pid, 'tid' => ['skin' => -1], @@ -297,7 +297,7 @@ class PlayerControllerTest extends TestCase $player->save(); $player->refresh(); - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/player/texture/clear', [ 'pid' => $player->pid, 'skin' => 1, // "1" stands for "true" @@ -318,7 +318,7 @@ class PlayerControllerTest extends TestCase option(['single_player' => true]); $user = factory(User::class)->create(); - $this->actAs($user)->postJson('/user/player/bind') + $this->actingAs($user)->postJson('/user/player/bind') ->assertJson([ 'errno' => 1, 'msg' => trans('validation.required', ['attribute' => 'player']), diff --git a/tests/ReportControllerTest.php b/tests/ReportControllerTest.php index 91677e60..2d9164cd 100644 --- a/tests/ReportControllerTest.php +++ b/tests/ReportControllerTest.php @@ -17,7 +17,7 @@ class ReportControllerTest extends TestCase $texture = factory(Texture::class)->create(); // Without `tid` field - $this->actAs($user) + $this->actingAs($user) ->postJson('/skinlib/report') ->assertJson([ 'errno' => 1, @@ -82,7 +82,7 @@ class ReportControllerTest extends TestCase $report->status = Report::PENDING; $report->save(); - $this->actAs($user) + $this->actingAs($user) ->getJson('/user/report-list') ->assertJson([[ 'tid' => 1, @@ -105,7 +105,7 @@ class ReportControllerTest extends TestCase $report->status = Report::PENDING; $report->save(); - $this->actAs($reporter) + $this->actingAs($reporter) ->getJson('/admin/report-data') ->assertJson([ 'totalRecords' => 1, @@ -137,7 +137,7 @@ class ReportControllerTest extends TestCase $report->refresh(); // Without `id` field - $this->actAs($reporter) + $this->actingAs($reporter) ->postJson('/admin/reports') ->assertJson([ 'errno' => 1, diff --git a/tests/SkinlibControllerTest.php b/tests/SkinlibControllerTest.php index 44163a99..bdeca959 100644 --- a/tests/SkinlibControllerTest.php +++ b/tests/SkinlibControllerTest.php @@ -229,7 +229,7 @@ class SkinlibControllerTest extends TestCase })); // Other users should not see someone's private textures - $items = $this->actAs($otherUser) + $items = $this->actingAs($otherUser) ->getJson('/skinlib/data') ->assertJson([ 'current_uid' => $otherUser->uid, @@ -253,7 +253,7 @@ class SkinlibControllerTest extends TestCase ]); // Uploader can see his private textures - $items = $this->actAs($uploader) + $items = $this->actingAs($uploader) ->getJson('/skinlib/data') ->assertJson([ 'current_uid' => $uploader->uid, @@ -266,7 +266,7 @@ class SkinlibControllerTest extends TestCase // Administrators can see private textures $admin = factory(User::class, 'admin')->create(); - $items = $this->actAs($admin) + $items = $this->actingAs($admin) ->getJson('/skinlib/data') ->assertJson([ 'current_uid' => $admin->uid, @@ -327,7 +327,7 @@ class SkinlibControllerTest extends TestCase ->assertViewHas('texture'); // Uploader should be able to see private textures - $this->actAs($uploader) + $this->actingAs($uploader) ->get('/skinlib/show/'.$texture->tid) ->assertViewHas('texture'); } @@ -524,7 +524,7 @@ class SkinlibControllerTest extends TestCase // Score is not enough $user = factory(User::class)->create(['score' => 0]); - $this->actAs($user) + $this->actingAs($user) ->postJson( '/skinlib/upload', [ @@ -542,7 +542,7 @@ class SkinlibControllerTest extends TestCase $user = factory(User::class)->create([ 'score' => (int) option('score_per_closet_item') + (int) option('score_per_storage'), ]); - $this->actAs($user)->postJson( + $this->actingAs($user)->postJson( '/skinlib/upload', [ 'name' => 'texture', @@ -584,7 +584,7 @@ class SkinlibControllerTest extends TestCase // Upload a duplicated texture $user = factory(User::class)->create(); - $this->actAs($user) + $this->actingAs($user) ->postJson( '/skinlib/upload', [ @@ -610,7 +610,7 @@ class SkinlibControllerTest extends TestCase option(['return_score' => false]); // Non-existed texture - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/delete', ['tid' => -1]) ->assertJson([ 'errno' => 1, @@ -618,7 +618,7 @@ class SkinlibControllerTest extends TestCase ]); // Other user should not be able to delete - $this->actAs($other) + $this->actingAs($other) ->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->assertJson([ 'errno' => 1, @@ -660,7 +660,7 @@ class SkinlibControllerTest extends TestCase // Return score option(['return_score' => true]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->assertJson([ 'errno' => 0, @@ -676,7 +676,7 @@ class SkinlibControllerTest extends TestCase 'uploader' => $uploader->uid, 'public' => false, ]); - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->assertJson([ 'errno' => 0, @@ -693,7 +693,7 @@ class SkinlibControllerTest extends TestCase option(['score_award_per_texture' => 5]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $uploader->refresh(); - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->assertJson(['errno' => 0]); $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]); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $uploader->refresh(); - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->assertJson(['errno' => 0]); $this->assertEquals($uploader->score, User::find($uploader->uid)->score); @@ -711,7 +711,7 @@ class SkinlibControllerTest extends TestCase 'public' => false ]); $uploader->refresh(); - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->assertJson(['errno' => 0]); $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->score = 0; $other->save(); - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/delete', ['tid' => $texture->tid]) ->assertJson(['errno' => 0]); $other->refresh(); @@ -736,7 +736,7 @@ class SkinlibControllerTest extends TestCase $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); // Non-existed texture - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/privacy', ['tid' => -1]) ->assertJson([ 'errno' => 1, @@ -744,7 +744,7 @@ class SkinlibControllerTest extends TestCase ]); // Other user should not be able to set privacy - $this->actAs($other) + $this->actingAs($other) ->postJson('/skinlib/privacy', ['tid' => $texture->tid]) ->assertJson([ 'errno' => 1, @@ -767,7 +767,7 @@ class SkinlibControllerTest extends TestCase $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); $uploader->score = 0; $uploader->save(); - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/privacy', ['tid' => $texture->tid]) ->assertJson([ 'errno' => 1, @@ -841,7 +841,7 @@ class SkinlibControllerTest extends TestCase $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); // Without `tid` field - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/rename') ->assertJson([ 'errno' => 1, @@ -887,7 +887,7 @@ class SkinlibControllerTest extends TestCase ]); // Other user should not be able to rename - $this->actAs($other) + $this->actingAs($other) ->postJson('/skinlib/rename', [ 'tid' => $texture->tid, 'new_name' => 'name', @@ -910,7 +910,7 @@ class SkinlibControllerTest extends TestCase $this->assertEquals('name', Texture::find($texture->tid)->name); // Uploader should be able to rename - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/rename', [ 'tid' => $texture->tid, 'new_name' => 'new_name', @@ -929,7 +929,7 @@ class SkinlibControllerTest extends TestCase $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); // Non-existed texture - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/model', [ 'tid' => -1, 'model' => 'alex', @@ -940,7 +940,7 @@ class SkinlibControllerTest extends TestCase ]); // Other user should not be able to change model - $this->actAs($other) + $this->actingAs($other) ->postJson('/skinlib/model', [ 'tid' => $texture->tid, 'model' => 'alex', @@ -963,7 +963,7 @@ class SkinlibControllerTest extends TestCase $this->assertEquals('alex', Texture::find($texture->tid)->type); // Uploader should be able to change model - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/model', [ 'tid' => $texture->tid, 'model' => 'steve', @@ -980,7 +980,7 @@ class SkinlibControllerTest extends TestCase ]); // Should fail if there is already a texture with same hash and chosen model - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/model', [ 'tid' => $texture->tid, 'model' => 'alex', @@ -993,7 +993,7 @@ class SkinlibControllerTest extends TestCase // Allow private texture $duplicate->public = false; $duplicate->save(); - $this->actAs($uploader) + $this->actingAs($uploader) ->postJson('/skinlib/model', [ 'tid' => $texture->tid, 'model' => 'alex', diff --git a/tests/UserControllerTest.php b/tests/UserControllerTest.php index dc10bce3..bb4876c2 100644 --- a/tests/UserControllerTest.php +++ b/tests/UserControllerTest.php @@ -19,14 +19,14 @@ class UserControllerTest extends TestCase $user = factory(User::class)->create(); factory(\App\Models\Player::class)->create(['uid' => $user->uid]); - $this->actAs($user) + $this->actingAs($user) ->get('/user') ->assertViewHas('statistics') ->assertSee((new Parsedown())->text(option_localized('announcement'))) ->assertSee((string) $user->score); $unverified = factory(User::class)->create(['verified' => false]); - $this->actAs($unverified) + $this->actingAs($unverified) ->get('/user') ->assertDontSee(trans('user.verification.notice.title')); } @@ -66,7 +66,7 @@ class UserControllerTest extends TestCase $user = factory(User::class)->create(); // Success - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/sign') ->assertJson([ 'errno' => 0, @@ -83,7 +83,7 @@ class UserControllerTest extends TestCase // Remaining time is greater than 0 $user = factory(User::class)->create(['last_sign_at' => get_datetime_string()]); option(['sign_gap_time' => 2]); - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/sign') ->assertJson([ 'errno' => 1, @@ -107,7 +107,7 @@ class UserControllerTest extends TestCase $diff = round($diff / 60); $unit = 'min'; } - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/sign') ->assertJson([ 'errno' => 1, @@ -123,7 +123,7 @@ class UserControllerTest extends TestCase $user = factory(User::class)->create([ 'last_sign_at' => \Carbon\Carbon::today()->toDateTimeString(), ]); - $this->actAs($user)->postJson('/user/sign') + $this->actingAs($user)->postJson('/user/sign') ->assertJson([ 'errno' => 0, ]); @@ -208,7 +208,7 @@ class UserControllerTest extends TestCase $user->changePassword('12345678'); // Invalid action - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/profile') ->assertJson([ 'errno' => 1, @@ -331,7 +331,7 @@ class UserControllerTest extends TestCase $user = User::find($user->uid); // Change email without `new_email` field - $this->actAs($user) + $this->actingAs($user) ->postJson( '/user/profile', ['action' => 'email'] @@ -408,7 +408,7 @@ class UserControllerTest extends TestCase $user->verified = true; $user->save(); // Delete account without `password` field - $this->actAs($user) + $this->actingAs($user) ->postJson( '/user/profile', ['action' => 'delete'] @@ -473,7 +473,7 @@ class UserControllerTest extends TestCase $cape = factory(\App\Models\Texture::class, 'cape')->create(); // Without `tid` field - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/profile/avatar') ->assertJson([ 'errno' => 1, @@ -481,7 +481,7 @@ class UserControllerTest extends TestCase ]); // TID is not a integer - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/profile/avatar', ['tid' => 'string']) ->assertJson([ 'errno' => 1, @@ -489,7 +489,7 @@ class UserControllerTest extends TestCase ]); // Texture cannot be found - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/profile/avatar', [ 'tid' => -1, ]) @@ -499,7 +499,7 @@ class UserControllerTest extends TestCase ]); // Use cape - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/profile/avatar', [ 'tid' => $cape->tid, ]) @@ -509,7 +509,7 @@ class UserControllerTest extends TestCase ]); // Success - $this->actAs($user) + $this->actingAs($user) ->postJson('/user/profile/avatar', [ 'tid' => $steve->tid, ])