mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-12-06 17:52:16 +00:00
Rename import controller methods to match the export controller
This commit is contained in:
committed by
Constantin Graf
parent
89d004f88c
commit
b5aa2f7e1a
@@ -28,7 +28,7 @@ class ImportController extends Controller
|
||||
*
|
||||
* @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');
|
||||
|
||||
@@ -99,7 +99,7 @@ class ImportController extends Controller
|
||||
*
|
||||
* @operationId getImports
|
||||
*/
|
||||
public function indexImports(Organization $organization, ImportIndexRequest $request): ImportCollection
|
||||
public function index(Organization $organization, ImportIndexRequest $request): ImportCollection
|
||||
{
|
||||
$this->checkPermission($organization, 'import');
|
||||
|
||||
|
||||
@@ -183,9 +183,9 @@ Route::prefix('v1')->name('v1.')->group(static function (): void {
|
||||
|
||||
// Import routes
|
||||
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::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');
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ use PHPUnit\Framework\Attributes\UsesClass;
|
||||
#[UsesClass(ImportController::class)]
|
||||
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
|
||||
$data = $this->createUserWithPermission();
|
||||
@@ -27,13 +27,13 @@ class ImportEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// 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
|
||||
$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
|
||||
$data = $this->createUserWithPermission([
|
||||
@@ -42,7 +42,7 @@ class ImportEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// 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
|
||||
$response->assertOk();
|
||||
|
||||
Reference in New Issue
Block a user