Rename import controller methods to match the export controller

This commit is contained in:
Constantin Graf
2026-11-18 18:24:01 +01:00
committed by Constantin Graf
parent 89d004f88c
commit b5aa2f7e1a
3 changed files with 8 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ class ImportController extends Controller
* *
* @response array{data: array<array{ key: string, name: string, description: string }>} * @response array{data: array<array{ key: string, name: string, description: string }>}
*/ */
public function index(Organization $organization, ImporterProvider $importerProvider): JsonResponse public function importers(Organization $organization, ImporterProvider $importerProvider): JsonResponse
{ {
$this->checkPermission($organization, 'import'); $this->checkPermission($organization, 'import');
@@ -99,7 +99,7 @@ class ImportController extends Controller
* *
* @operationId getImports * @operationId getImports
*/ */
public function indexImports(Organization $organization, ImportIndexRequest $request): ImportCollection public function index(Organization $organization, ImportIndexRequest $request): ImportCollection
{ {
$this->checkPermission($organization, 'import'); $this->checkPermission($organization, 'import');

View File

@@ -183,9 +183,9 @@ Route::prefix('v1')->name('v1.')->group(static function (): void {
// Import routes // Import routes
Route::name('import.')->prefix('/organizations/{organization}')->group(static function (): void { Route::name('import.')->prefix('/organizations/{organization}')->group(static function (): void {
Route::get('/importers', [ImportController::class, 'index'])->name('index'); Route::get('/importers', [ImportController::class, 'importers'])->name('importers');
Route::post('/import', [ImportController::class, 'import'])->name('import')->middleware('check-organization-blocked'); Route::post('/import', [ImportController::class, 'import'])->name('import')->middleware('check-organization-blocked');
Route::get('/imports', [ImportController::class, 'indexImports'])->name('imports.index'); Route::get('/imports', [ImportController::class, 'index'])->name('imports.index');
Route::get('/imports/{import}', [ImportController::class, 'show'])->name('imports.show'); Route::get('/imports/{import}', [ImportController::class, 'show'])->name('imports.show');
}); });

View File

@@ -19,7 +19,7 @@ use PHPUnit\Framework\Attributes\UsesClass;
#[UsesClass(ImportController::class)] #[UsesClass(ImportController::class)]
class ImportEndpointTest extends ApiEndpointTestAbstract class ImportEndpointTest extends ApiEndpointTestAbstract
{ {
public function test_index_fails_if_user_does_not_have_permission(): void public function test_importers_fails_if_user_does_not_have_permission(): void
{ {
// Arrange // Arrange
$data = $this->createUserWithPermission(); $data = $this->createUserWithPermission();
@@ -27,13 +27,13 @@ class ImportEndpointTest extends ApiEndpointTestAbstract
Passport::actingAs($data->user); Passport::actingAs($data->user);
// Act // Act
$response = $this->getJson(route('api.v1.import.index', ['organization' => $data->organization->getKey()])); $response = $this->getJson(route('api.v1.import.importers', ['organization' => $data->organization->getKey()]));
// Assert // Assert
$response->assertForbidden(); $response->assertForbidden();
} }
public function test_index_returns_importers_if_user_has_permission(): void public function test_importers_returns_importers_if_user_has_permission(): void
{ {
// Arrange // Arrange
$data = $this->createUserWithPermission([ $data = $this->createUserWithPermission([
@@ -42,7 +42,7 @@ class ImportEndpointTest extends ApiEndpointTestAbstract
Passport::actingAs($data->user); Passport::actingAs($data->user);
// Act // Act
$response = $this->getJson(route('api.v1.import.index', ['organization' => $data->organization->getKey()])); $response = $this->getJson(route('api.v1.import.importers', ['organization' => $data->organization->getKey()]));
// Assert // Assert
$response->assertOk(); $response->assertOk();