If there is no argument the connection error should be checked for an error. Add a test for most of lastError(). Mocking PDO is a pain. Fixes #2046