Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_failed() method doesn't work in Cest #1660

Closed
for93t opened this issue Jan 21, 2015 · 0 comments
Closed

_failed() method doesn't work in Cest #1660

for93t opened this issue Jan 21, 2015 · 0 comments
Milestone

Comments

@for93t
Copy link

@for93t for93t commented Jan 21, 2015

The documentation says that it is possible to define a _failed() method which will be executed in case an error occurs or a test fails. However a simple scenario, like this one:

<?php

class TearDownCest
{
    protected $_domain;

    public function _before(WebGuy $I)
    {
        file_put_contents(__DIR__ . '/TearDownCest.out', "_before() call\n", FILE_APPEND);
    }

    public function _after(WebGuy $I)
    {
        file_put_contents(__DIR__ . '/TearDownCest.out', "_after() call\n", FILE_APPEND);
    }

    public function _failed(WebGuy $I)
    {
        file_put_contents(__DIR__ . '/TearDownCest.out', "_failed() call\n", FILE_APPEND);

        $this->_after($I);
    }

    public function goodTest(WebGuy $I)
    {
        $I->seeTrue(true);
    }

    public function badTest(WebGuy $I)
    {
        $I->seeTrue(false);
    }
}

does not work as expected, the "log" file contains only the following entries:

$ cat tests/acceptance/TearDownCest.out 
_before() call
_after() call
_before() call
@DavertMik DavertMik closed this in 3d85eb2 Feb 2, 2015
@DavertMik DavertMik added this to the 2.0.10 milestone Feb 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.