Open tarreislam opened 4 years ago
When running the command `laravel-test:generate files will have duplicate methodNames,
`laravel-test:generate
I Havent had the time looking for the problem but here the only thing I would assume is that it will look at "PUT|PATCH" as two separate methods?
I dono, here is some data
| | POST | api/event-types | event-types.store | App\Http\Controllers\EventTypeController@store | api,App\Http\Middleware\Authenticate | | | GET|HEAD | api/event-types | event-types.index | App\Http\Controllers\EventTypeController@index | api,App\Http\Middleware\Authenticate | | | DELETE | api/event-types/{event_type} | event-types.destroy | App\Http\Controllers\EventTypeController@destroy | api,App\Http\Middleware\Authenticate | | | PUT|PATCH | api/event-types/{event_type} | event-types.update | App\Http\Controllers\EventTypeController@update | api,App\Http\Middleware\Authenticate | | | GET|HEAD | api/event-types/{event_type} | event-types.show | App\Http\Controllers\EventTypeController@show | api,App\Http\Middleware\Authenticate |
<?php namespace Tests\Feature; use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\RefreshDatabase; class EventTypeTest extends TestCase { /** * Index * * @return void */ public function testIndexWithError() { $response = $this->json('GET', '/api/event-types', []); $response->assertStatus(400); } /** * Index * * @return void */ public function testIndex() { $response = $this->json('GET', '/api/event-types', []); $response->assertStatus(200); } /** * Store * * @return void */ public function testStoreWithError() { $response = $this->json('POST', '/api/event-types', [ "event_id" => "", "description" => "" ]); $response->assertStatus(400); } /** * Store * * @return void */ public function testStore() { $response = $this->json('POST', '/api/event-types', [ "event_id" => "", "description" => "" ]); $response->assertStatus(200); } /** * Show * * @return void */ public function testShowWithError() { $response = $this->json('GET', '/api/event-types/{event_type}', []); $response->assertStatus(400); } /** * Show * * @return void */ public function testShow() { $response = $this->json('GET', '/api/event-types/{event_type}', []); $response->assertStatus(200); } /** * Update * * @return void */ public function testUpdateWithError() { $response = $this->json('PUT', '/api/event-types/{event_type}', [ "event_id" => "", "description" => "" ]); $response->assertStatus(400); } /** * Update * * @return void */ public function testUpdate() { $response = $this->json('PUT', '/api/event-types/{event_type}', [ "event_id" => "", "description" => "" ]); $response->assertStatus(200); } /** * Update * * @return void */ public function testUpdateWithError() { $response = $this->json('PATCH', '/api/event-types/{event_type}', [ "event_id" => "", "description" => "" ]); $response->assertStatus(400); } /** * Update * * @return void */ public function testUpdate() { $response = $this->json('PATCH', '/api/event-types/{event_type}', [ "event_id" => "", "description" => "" ]); $response->assertStatus(200); } /** * Destroy * * @return void */ public function testDestroyWithError() { $response = $this->json('DELETE', '/api/event-types/{event_type}', []); $response->assertStatus(400); } /** * Destroy * * @return void */ public function testDestroy() { $response = $this->json('DELETE', '/api/event-types/{event_type}', []); $response->assertStatus(200); } }
/** * Update * * @return void */ public function testUpdateWithError() { $response = $this->json('PATCH', '/api/event-types/{event_type}', [ "event_id" => "", "description" => "" ]); $response->assertStatus(400); } /** * Update * * @return void */ public function testUpdate() { $response = $this->json('PATCH', '/api/event-types/{event_type}', [ "event_id" => "", "description" => "" ]); $response->assertStatus(200); }
When running the command
`laravel-test:generate
files will have duplicate methodNames,I Havent had the time looking for the problem but here the only thing I would assume is that it will look at "PUT|PATCH" as two separate methods?
I dono, here is some data
Routes
Generated file
Duplicates