Skip to content

Commit

Permalink
Merge pull request #1078 from uasoft-indonesia/analysis-01jpRL
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
miftahurrahmi authored Jul 9, 2024
2 parents 9db8ba4 + f2331c3 commit 74db023
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/Controllers/BadasoCRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ 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);
Expand Down
1 change: 1 addition & 0 deletions src/Database/Schema/SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public static function describeTable($table_name)
$indexType = array_values($column_array['indexes'])[0]['type'];
$column_array['key'] = substr($indexType, 0, 3);
}

return $column_array;
});
}
Expand Down
13 changes: 5 additions & 8 deletions tests/Feature/BadasoApiCrudManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ private function createTestTables(int $max_count_table_generate)
$table_names = [];
for ($index = 1; $index <= $max_count_table_generate; $index++) {
$table_name = "{$this->TABLE_TEST_PREFIX}{$index}";
if (!Schema::hasTable($table_name)) {
if (! Schema::hasTable($table_name)) {
Schema::create($table_name, function (Blueprint $table) use ($index, $table_names) {
$table->id();

Expand Down Expand Up @@ -441,7 +441,7 @@ private function createTestEmptyValueTables(int $max_count_table_generate)
$table_names = [];
for ($index = 1; $index <= $max_count_table_generate; $index++) {
$table_name = "{$this->TABLE_TEST_EMPTY_VALUE_PREFIX}{$index}";
if (!Schema::hasTable($table_name)) {
if (! Schema::hasTable($table_name)) {
Schema::create($table_name, function (Blueprint $table) use ($index, $table_names) {
$table->id();

Expand Down Expand Up @@ -593,7 +593,6 @@ public function testAddCrudManagement()
],
];
foreach ($const_fields as $key => ['badaso_type' => $badaso_type, 'schema_type' => $schema_type, 'details' => $details]) {

if ($index_table_name == 0 && $badaso_type == 'relation') {
continue;
}
Expand Down Expand Up @@ -646,7 +645,7 @@ class {$model_name} extends Model {
}
PHP;
$model_path = app_path("Models/$model_file_name");
if (!file_exists($model_path)) {
if (! file_exists($model_path)) {
file_put_contents($model_path, $model_body);
}

Expand All @@ -667,7 +666,7 @@ class {$model_name} extends Model {
$controller_data = [];
if (rand(0, 1)) {
// create new controller
$controller_name = str_replace([' ', '_'], '', ucwords($table_name)) . 'Controller';
$controller_name = str_replace([' ', '_'], '', ucwords($table_name)).'Controller';
$controller_file_name = "{$controller_name}.php";
$controller_body = <<<PHP
<?php
Expand All @@ -676,7 +675,7 @@ class {$model_name} extends Model {
class {$controller_name} extends \Uasoft\Badaso\Controllers\BadasoBaseController {}
PHP;
$controller_path = app_path("/Http/Controllers/$controller_file_name");
if (!file_exists($controller_path)) {
if (! file_exists($controller_path)) {
file_put_contents($controller_path, $controller_body);
}

Expand Down Expand Up @@ -1058,9 +1057,7 @@ public function testAddTableCrudMultiRelationEntity()
foreach ($add_crud_table as $key => $request_data_crud_table) {
$response = CallHelperTest::withAuthorizeBearer($this)->json('POST', CallHelperTest::getUrlApiV1Prefix('/crud/add'), $request_data_crud_table);
// $response->assertSuccessful();

}

}

public function testAddTableManyToMany()
Expand Down

0 comments on commit 74db023

Please sign in to comment.