From 9db8ba411da6a5dcf2c572b3aad3077362b79c3a Mon Sep 17 00:00:00 2001 From: Miftahurrahmi Date: Tue, 9 Jul 2024 17:08:12 +0700 Subject: [PATCH] fixing unit test --- src/Controllers/BadasoCRUDController.php | 2 + src/Database/Schema/SchemaManager.php | 5 +- .../js/layout/admin/footer/Footer.vue | 2 +- tests/Feature/BadasoApiCrudManagementTest.php | 60 ++++++------------- 4 files changed, 23 insertions(+), 46 deletions(-) diff --git a/src/Controllers/BadasoCRUDController.php b/src/Controllers/BadasoCRUDController.php index 5a79d0ee8..f30a6f6ff 100644 --- a/src/Controllers/BadasoCRUDController.php +++ b/src/Controllers/BadasoCRUDController.php @@ -316,6 +316,7 @@ function ($attribute, $value, $fail) { 'required', function ($attribute, $value, $fail) use ($request) { if (! Schema::hasColumn($request->name, $value)) { + $split_attribute = explode('.', $attribute); $split_attribute[2] = 'relation_type'; $field_to_relation = join('.', $split_attribute); @@ -432,6 +433,7 @@ function ($attribute, $value, $fail) use ($request) { return ApiResponse::success($new_data_type); } catch (Exception $e) { + // dd($e); DB::rollBack(); return ApiResponse::failed($e); diff --git a/src/Database/Schema/SchemaManager.php b/src/Database/Schema/SchemaManager.php index 80e7982f5..d097ebf71 100644 --- a/src/Database/Schema/SchemaManager.php +++ b/src/Database/Schema/SchemaManager.php @@ -60,9 +60,7 @@ public static function listTableDetails($table_name) $columns = $sm->listTableColumns($table_name); $foreign_keys = []; - if (static::registerConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { - $foreign_keys = $sm->listTableForeignKeys($table_name); - } + $foreign_keys = $sm->listTableForeignKeys($table_name); $indexes = $sm->listTableIndexes($table_name); @@ -129,7 +127,6 @@ public static function describeTable($table_name) $indexType = array_values($column_array['indexes'])[0]['type']; $column_array['key'] = substr($indexType, 0, 3); } - return $column_array; }); } diff --git a/src/resources/js/layout/admin/footer/Footer.vue b/src/resources/js/layout/admin/footer/Footer.vue index fa17208de..092426194 100644 --- a/src/resources/js/layout/admin/footer/Footer.vue +++ b/src/resources/js/layout/admin/footer/Footer.vue @@ -2,7 +2,7 @@