Skip to content

teardown() is called twice #266

Description

@forrest79

In version 1.6 we have this problem. Our DB abstraction has some of the following code (simplified):

$resource = @pg_query_params($this->getResource(), $sql, $variables);

if (is_resource($resource) === FALSE) {
    throw new Database\QueryException('Database query failed. ' . $this->getLastError());
}

For our DB tests, we begin transaction in setUp() and we rollback it in tearDown(). If we want to test some QueryException via Assert::exception(...), in Tester 1.6 is called tearDown before generating our QueryExceptionm because @pg_query_params generate WARNING or NOTICE (which is suppressed by @) and this called new $errorHandler from Framework/TestCase.php line 109. This close transaction in our code and I get bad error message (because I don't have last error...) and after that is called tearDown properly from line 143.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions