From 4a97edbd53dd56cfa4917e7f792afd3c23d9f468 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Sun, 12 Jan 2020 17:12:00 +0800 Subject: [PATCH] remove middlewares for profile API --- routes/static.php | 6 ++---- .../HttpTest/ControllersTest/TextureControllerTest.php | 4 +--- tests/HttpTest/MiddlewareTest/CheckPlayerExistTest.php | 10 +--------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/routes/static.php b/routes/static.php index 861cd323..60aedb56 100644 --- a/routes/static.php +++ b/routes/static.php @@ -1,9 +1,7 @@ 'player'], function () { - Route::get('/{player}.json', 'TextureController@json'); - Route::get('/csl/{player}.json', 'TextureController@json'); -}); +Route::get('/{player}.json', 'TextureController@json'); +Route::get('/csl/{player}.json', 'TextureController@json'); Route::get('/textures/{hash}', 'TextureController@texture'); diff --git a/tests/HttpTest/ControllersTest/TextureControllerTest.php b/tests/HttpTest/ControllersTest/TextureControllerTest.php index 97f849c9..bfed404d 100644 --- a/tests/HttpTest/ControllersTest/TextureControllerTest.php +++ b/tests/HttpTest/ControllersTest/TextureControllerTest.php @@ -26,9 +26,7 @@ class TextureControllerTest extends TestCase $steve = factory(Texture::class)->create(); // Player is not existed - $this->get('/nope.json') - ->assertSee(trans('general.unexistent-player')) - ->assertStatus(404); + $this->get('/nope.json')->assertStatus(404); // Player is banned $player = factory(Player::class)->create(['tid_skin' => $steve->tid]); diff --git a/tests/HttpTest/MiddlewareTest/CheckPlayerExistTest.php b/tests/HttpTest/MiddlewareTest/CheckPlayerExistTest.php index ef4dbfea..c5d43ca9 100644 --- a/tests/HttpTest/MiddlewareTest/CheckPlayerExistTest.php +++ b/tests/HttpTest/MiddlewareTest/CheckPlayerExistTest.php @@ -14,20 +14,12 @@ class CheckPlayerExistTest extends TestCase { Event::fake(); - $this->getJson('/nope.json') - ->assertStatus(404) - ->assertSee(trans('general.unexistent-player')); - - option(['return_204_when_notfound' => true]); - $this->getJson('/nope.json')->assertNoContent(); + $this->getJson('/nope.json')->assertStatus(404); $player = factory(Player::class)->create(); $this->getJson("/{$player->name}.json") ->assertJson(['username' => $player->name]); // Default is CSL API - $this->getJson("/{$player->name}.json"); - Event::assertDispatched(\App\Events\CheckPlayerExists::class); - $player = factory(Player::class)->create(); $user = $player->user; $this->actingAs($user)