Update HostingSubscriptionBackupTest.php

This commit is contained in:
Bozhidar 2024-04-26 16:05:44 +03:00
parent 7636ef38b2
commit 133f472644

View file

@ -89,7 +89,22 @@ class HostingSubscriptionBackupTest extends ActionTestCase
Helpers::extractTar($findBackup->filepath, $findBackup->path . '/unit-test');
//
// dd($chs);
// dd($findBackup->path);
$findDatabase = Database::where('id', $chs['databaseId'])->first();
$extractedDatabase = $findBackup->path . '/unit-test/' . $findDatabase->database_name_prefix . $findDatabase->database_name . '.sql';
$this->assertTrue(file_exists($extractedDatabase));
$extractedDatabaseContent = file_get_contents($extractedDatabase);
$this->assertNotEmpty($extractedDatabaseContent);
foreach ($chs['databaseTableData'] as $tableName => $tableData) {
$this->assertStringContainsString('CREATE TABLE `' . $tableName . '`', $extractedDatabaseContent);
foreach ($tableData as $data) {
$this->assertStringContainsString('INSERT INTO `' . $tableName . '`', $extractedDatabaseContent);
$this->assertStringContainsString($data['name'], $extractedDatabaseContent);
$this->assertStringContainsString($data['email'], $extractedDatabaseContent);
$this->assertStringContainsString($data['phone'], $extractedDatabaseContent);
}
}
}