Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #1078

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading