Skip to content

Commit bcb490e

Browse files
debug: return one commented test
1 parent 33cfb1e commit bcb490e

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

tests/BackupTablesTest.php

+24-25
Original file line numberDiff line numberDiff line change
@@ -60,32 +60,31 @@ public function test_generate_single_table_backup_with_with_custom_format()
6060
$this->assertTrue(Schema::hasTable($newTableName));
6161
}
6262

63+
public function test_generate_single_table_backup_all_table_data()
64+
{
65+
Carbon::setTestNow();
66+
$tableName = 'fathers';
6367

64-
//public function test_generate_single_table_backup_all_table_data()
65-
//{
66-
// Carbon::setTestNow();
67-
// $tableName = 'fathers';
68-
//
69-
// Father::create([
70-
// 'id' => 1,
71-
// 'first_name' => 'Ahmed',
72-
// 'last_name' => 'Saleh',
73-
// 'email' => 'father@email.com',
74-
// ]);
75-
//
76-
// BackupTables::generateBackup($tableName);
77-
//
78-
// $newTableName = $tableName.'_backup_'.now()->format('Y_m_d_H_i_s');
79-
//
80-
// $this->assertTrue(Schema::hasTable($newTableName));
81-
//
82-
// $this->assertEquals(DB::table($tableName)->value('first_name'), DB::table($newTableName)->value('first_name'));
83-
// $this->assertEquals(DB::table($tableName)->value('email'), DB::table($newTableName)->value('email'));
84-
//
85-
// if (DB::getDriverName() == 'mysql' || DB::getDriverName() == 'mariadb' || (float) App::version() >= Constants::VERSION_AFTER_STORED_AS_VIRTUAL_AS_SUPPORT) {
86-
// $this->assertEquals(DB::table($tableName)->value('full_name'), DB::table($newTableName)->value('full_name')); // StoredAs tables
87-
// }
88-
//}
68+
Father::create([
69+
'id' => 1,
70+
'first_name' => 'Ahmed',
71+
'last_name' => 'Saleh',
72+
'email' => 'father@email.com',
73+
]);
74+
75+
BackupTables::generateBackup($tableName);
76+
77+
$newTableName = $tableName.'_backup_'.now()->format('Y_m_d_H_i_s');
78+
79+
$this->assertTrue(Schema::hasTable($newTableName));
80+
81+
$this->assertEquals(DB::table($tableName)->value('first_name'), DB::table($newTableName)->value('first_name'));
82+
$this->assertEquals(DB::table($tableName)->value('email'), DB::table($newTableName)->value('email'));
83+
84+
if (DB::getDriverName() == 'mysql' || DB::getDriverName() == 'mariadb' || (float) App::version() >= Constants::VERSION_AFTER_STORED_AS_VIRTUAL_AS_SUPPORT) {
85+
$this->assertEquals(DB::table($tableName)->value('full_name'), DB::table($newTableName)->value('full_name')); // StoredAs tables
86+
}
87+
}
8988

9089

9190
public function test_generate_single_table_backup_with_different_data()

todos.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
- [x] write automated tests for the code,
1212
- [x] fix duplicate console `Table 'fathers' completed backup successfully.` when use `test_generate_2_single_table_backup_all_table_data`
1313
- [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
14-
- [ ] extract `mysql 8`, `mysql 5.7` and `mariadb` in separate GitHub actions if the still conflicts with each other and works fine alone.
15-
- [ ] return back pint formatting GitHub actions
14+
- [x] extract `mysql 8`, `mysql 5.7` and `mariadb` in separate GitHub actions if the still conflicts with each other and works fine alone.
15+
- [ ] fix for foreign keys, and return foreign key father_id
1616
- [ ] check the console output when backup is correct and make in tests (prefer)
17-
- [ ] fix for foreign keys, and return foreign key father_id
18-
- [ ] clean up the code
19-
- [ ] fix all todo in the code, and remove commented code
17+
- [ ] return back pint formatting GitHub actions
18+
- [ ] clean up the code, fix all todo in the code, and remove commented code

0 commit comments

Comments
 (0)