remove middlewares for profile API

This commit is contained in:
Pig Fang 2020-01-12 17:12:00 +08:00
parent f46737c8e3
commit 4a97edbd53
3 changed files with 4 additions and 16 deletions

View File

@ -1,9 +1,7 @@
<?php
Route::group(['middleware' => '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');

View File

@ -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]);

View File

@ -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)