Laravel\Lumen\Testing\TestCase::tearDown PHP Method

tearDown() public method

Clean up the testing environment before the next test.
public tearDown ( ) : void
return void
    public function tearDown()
    {
        if (class_exists('Mockery')) {
            Mockery::close();
        }
        if ($this->app) {
            foreach ($this->beforeApplicationDestroyedCallbacks as $callback) {
                call_user_func($callback);
            }
            $this->app->flush();
            $this->app = null;
        }
    }

Usage Example

Example #1
0
 public function tearDown()
 {
     DB::connection()->rollBack();
     //rollback the transaction so the test case can be rerun without duplicate key exceptions
     DB::connection()->setPdo(null);
     //close the pdo connection to `avoid too many connections` errors
     parent::tearDown();
 }
All Usage Examples Of Laravel\Lumen\Testing\TestCase::tearDown