Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Create new test scope for each test and not only once #182

Open
fbrnc opened this issue Mar 5, 2014 · 0 comments
Open

Create new test scope for each test and not only once #182

fbrnc opened this issue Mar 5, 2014 · 0 comments

Comments

@fbrnc
Copy link

fbrnc commented Mar 5, 2014

Currently applyTestScope is only called once for the top level suite (and discardTestScope is only called at the end of the top level suite).

It would be much better if ever test would run in complete isolation starting with a fresh testScope (included registry,...) in order to make sure that there are not side effects from left-overs from previous tests.

Currently this can be done without code changes in EcomDev_PHPUnit by adding adding following to the individual test class (or a shared common parent class)

protected function setUp() {
    EcomDev_PHPUnit_Model_App::applyTestScope();
    // ... do custom stuff if required
    parent::setUp();
}

protected function tearDown()
{
    parent::tearDown();
    // ... do custom stuff if required
    EcomDev_PHPUnit_Model_App::discardTestScope();
}

Please note that this relies on #178 being in place

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant