Skip to content
This repository was archived by the owner on May 27, 2023. It is now read-only.
This repository was 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

Description

@fbrnc

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

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions