From f3220ee52640f2c4ae57cb22b2c3512e65ee256c Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Sun, 11 Mar 2018 11:20:21 +0800 Subject: [PATCH] test: disconnect database after each test --- tests/TestCase.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/TestCase.php b/tests/TestCase.php index 667b7f9f..867b06f1 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -42,4 +42,12 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase } return $this->withSession(['uid' => $role->uid, 'token' => $role->getToken()]); } + + protected function tearDown() + { + $this->beforeApplicationDestroyed(function () { + DB::disconnect(); + }); + parent::tearDown(); + } }