@spyralex If you want to check the connection see the answers here...
https://stackoverflow.com/questions/24190647/how-to-test-mysql-connection-in-php-and-laravel
If you want to trigger an exception just throw a new Illuminate\Database\QueryException
There isn't really much need to test a broken connection as that will simply throw an Exception.