From 7636ef38b217cdf4f6dd2db27067652baad4e202 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Fri, 26 Apr 2024 16:01:21 +0300 Subject: [PATCH] Update HostingSubscriptionBackupTest.php --- .../Unit/HostingSubscriptionBackupTest.php | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/web/tests/Unit/HostingSubscriptionBackupTest.php b/web/tests/Unit/HostingSubscriptionBackupTest.php index 3a17ab8..a1e5101 100644 --- a/web/tests/Unit/HostingSubscriptionBackupTest.php +++ b/web/tests/Unit/HostingSubscriptionBackupTest.php @@ -87,7 +87,9 @@ class HostingSubscriptionBackupTest extends ActionTestCase $this->assertSame(Helpers::checkPathSize($findBackup->path), $findBackup->size); Helpers::extractTar($findBackup->filepath, $findBackup->path . '/unit-test'); - +// +// dd($chs); +// dd($findBackup->path); } @@ -162,25 +164,50 @@ class HostingSubscriptionBackupTest extends ActionTestCase $table->timestamps(); }); + Schema::connection($unitTestDbConnection) + ->create('second_random_table', function ($table) { + $table->increments('id'); + $table->string('name')->nullable(); + $table->string('email')->nullable(); + $table->string('phone')->nullable(); + $table->timestamps(); + }); + $this->assertTrue(Schema::connection($unitTestDbConnection) ->hasTable('random_table')); + $this->assertTrue(Schema::connection($unitTestDbConnection) + ->hasTable('second_random_table')); + + $databaseTableData = []; for ($i = 0; $i < 200; $i++) { + $databaseData = [ + 'name' => 'UnitBackupTest' . time() . $i, + 'email' => 'UnitBackupTest' . time() . $i . '@unit-test.com', + 'phone' => time(), + 'created_at' => now(), + 'updated_at' => now(), + ]; + $databaseTableData['random_table'][] = $databaseData; + $databaseTableData['second_random_table'][] = $databaseData; + DB::connection($unitTestDbConnection) ->table('random_table') - ->insert([ - 'name' => 'UnitBackupTest' . time() . $i, - 'email' => 'UnitBackupTest' . time() . $i . '@unit-test.com', - 'phone' => time(), - 'created_at' => now(), - 'updated_at' => now(), - ]); + ->insert($databaseData); + + DB::connection($unitTestDbConnection) + ->table('second_random_table') + ->insert($databaseData); } return [ 'customerId' => $customer->id, 'hostingPlanId' => $hostingPlan->id, 'hostingSubscriptionId' => $hostingSubscription->id, + 'databaseId' => $database->id, + 'databaseUserId' => $databaseUser->id, + 'databaseConnection' => $unitTestDbConnection, + 'databaseTableData' => $databaseTableData ]; } }