Skip to content

Commit

Permalink
debug: return one commented test
Browse files Browse the repository at this point in the history
  • Loading branch information
WatheqAlshowaiter committed Aug 23, 2024
1 parent 33cfb1e commit bcb490e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
49 changes: 24 additions & 25 deletions tests/BackupTablesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,31 @@ public function test_generate_single_table_backup_with_with_custom_format()
$this->assertTrue(Schema::hasTable($newTableName));
}

public function test_generate_single_table_backup_all_table_data()
{
Carbon::setTestNow();
$tableName = 'fathers';

//public function test_generate_single_table_backup_all_table_data()
//{
// Carbon::setTestNow();
// $tableName = 'fathers';
//
// Father::create([
// 'id' => 1,
// 'first_name' => 'Ahmed',
// 'last_name' => 'Saleh',
// 'email' => '[email protected]',
// ]);
//
// BackupTables::generateBackup($tableName);
//
// $newTableName = $tableName.'_backup_'.now()->format('Y_m_d_H_i_s');
//
// $this->assertTrue(Schema::hasTable($newTableName));
//
// $this->assertEquals(DB::table($tableName)->value('first_name'), DB::table($newTableName)->value('first_name'));
// $this->assertEquals(DB::table($tableName)->value('email'), DB::table($newTableName)->value('email'));
//
// if (DB::getDriverName() == 'mysql' || DB::getDriverName() == 'mariadb' || (float) App::version() >= Constants::VERSION_AFTER_STORED_AS_VIRTUAL_AS_SUPPORT) {
// $this->assertEquals(DB::table($tableName)->value('full_name'), DB::table($newTableName)->value('full_name')); // StoredAs tables
// }
//}
Father::create([
'id' => 1,
'first_name' => 'Ahmed',
'last_name' => 'Saleh',
'email' => '[email protected]',
]);

BackupTables::generateBackup($tableName);

$newTableName = $tableName.'_backup_'.now()->format('Y_m_d_H_i_s');

$this->assertTrue(Schema::hasTable($newTableName));

$this->assertEquals(DB::table($tableName)->value('first_name'), DB::table($newTableName)->value('first_name'));
$this->assertEquals(DB::table($tableName)->value('email'), DB::table($newTableName)->value('email'));

if (DB::getDriverName() == 'mysql' || DB::getDriverName() == 'mariadb' || (float) App::version() >= Constants::VERSION_AFTER_STORED_AS_VIRTUAL_AS_SUPPORT) {
$this->assertEquals(DB::table($tableName)->value('full_name'), DB::table($newTableName)->value('full_name')); // StoredAs tables
}
}


public function test_generate_single_table_backup_with_different_data()
Expand Down
9 changes: 4 additions & 5 deletions todos.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
- [x] write automated tests for the code,
- [x] fix duplicate console `Table 'fathers' completed backup successfully.` when use `test_generate_2_single_table_backup_all_table_data`
- [x] add database drop list (sqlite, mysql, sql server, mariadb, postgres) + version for each of them in the ISSUE_TEMPLATE, and make it required and even add it to the next
- [ ] extract `mysql 8`, `mysql 5.7` and `mariadb` in separate GitHub actions if the still conflicts with each other and works fine alone.
- [ ] return back pint formatting GitHub actions
- [x] extract `mysql 8`, `mysql 5.7` and `mariadb` in separate GitHub actions if the still conflicts with each other and works fine alone.
- [ ] fix for foreign keys, and return foreign key father_id
- [ ] check the console output when backup is correct and make in tests (prefer)
- [ ] fix for foreign keys, and return foreign key father_id
- [ ] clean up the code
- [ ] fix all todo in the code, and remove commented code
- [ ] return back pint formatting GitHub actions
- [ ] clean up the code, fix all todo in the code, and remove commented code

0 comments on commit bcb490e

Please sign in to comment.