fix: check tables if it's existed when db is connected

This commit is contained in:
Pig Fang 2019-02-18 17:15:14 +08:00
parent f7b5046a38
commit 6d93a78d22
2 changed files with 13 additions and 1 deletions

View File

@ -245,7 +245,11 @@ class SetupController extends Controller
{
if (request()->is('setup') || request()->is('setup/database')) {
// We're ready to install Blessing Skin, so skip the checks.
return false;
try {
DB::connection(env('DB_CONNECTION'))->getPdo();
} catch (\Exception $e) {
return false;
}
}
$existingTables = [];

View File

@ -2,6 +2,7 @@
namespace Tests;
use DB;
use App\Models\User;
use App\Services\Facades\Option;
use Illuminate\Support\Facades\Schema;
@ -119,6 +120,13 @@ class MiddlewareTest extends TestCase
'setup.wizard.welcome.text',
['version' => config('app.version')]
));
DB::shouldReceive('connection')->once()->andThrow(new \Exception('fake exception'));
DB::shouldReceive('disconnect')->andReturnSelf();
$this->get('/setup')->assertSee(trans(
'setup.wizard.welcome.text',
['version' => config('app.version')]
));
}
public function testCheckPlayerExist()