Skip to content

run tearDown() if TestCase fails with PHP error [closes #254]#255

Closed
richard-ejem wants to merge 1 commit intonette:masterfrom
richard-ejem:teardown
Closed

run tearDown() if TestCase fails with PHP error [closes #254]#255
richard-ejem wants to merge 1 commit intonette:masterfrom
richard-ejem:teardown

Conversation

@richard-ejem
Copy link
Copy Markdown
Contributor

No description provided.

@richard-ejem richard-ejem force-pushed the teardown branch 2 times, most recently from 0f84e3f to 016d854 Compare September 18, 2015 21:21
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore handler here to prevent recursion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done ;)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name it as _tearDown() and fix coding style. Double empty line between methods, one empty line after the last one, curly bracket on separated line.

@milo
Copy link
Copy Markdown
Member

milo commented Oct 3, 2015

What about

    /** @internal */
    public function _errorHandler()
    {
        restore_error_handler();
        @$this->tearDown(); // ignore, error from testMethod() has higher precedence

        return $this->previousHandler
            ? call_user_func_array($this->previousHandler, func_get_args())
            : FALSE;
    }

milo added a commit to milo/tester that referenced this pull request Oct 9, 2015
milo added a commit to milo/tester that referenced this pull request Oct 9, 2015
milo added a commit to milo/tester that referenced this pull request Oct 9, 2015
@richard-ejem
Copy link
Copy Markdown
Contributor Author

@milo thanks for suggestion, I like your _errorHandler alternative :) fixed in my code

@milo
Copy link
Copy Markdown
Member

milo commented Oct 13, 2015

Solved by d25b672.

@milo milo closed this Oct 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants