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

Documentation for 'cleanup' configuration option #25

Open
7118path opened this issue Aug 23, 2021 · 3 comments
Open

Documentation for 'cleanup' configuration option #25

7118path opened this issue Aug 23, 2021 · 3 comments

Comments

@7118path
Copy link

7118path commented Aug 23, 2021

Hi,

seems like the documentation for the 'cleanup' configuration option ist not correct:

cleanup: false - whether the dump should be reloaded before each test

It think more correct would be:

cleanup: false - whether all database tables should be dropped

I am not quite sure if this dropping happens once or before each test.
The docs mention the 'clearing' of the database, but not in connection with this option.

Make this more precise would be great!

@Naktibalda
Copy link
Member

Actually cleanup does both things - drops all tables and loads the dump file.

@Naktibalda
Copy link
Member

Documentation:

populate: false - whether the the dump should be loaded before the test suite is started
cleanup: false - whether the dump should be reloaded before each test

I had another look today.
Multi-DB change back in 2018 made cleanup code really difficult to follow.

I see that cleanup is dependent on populate - if populate is off, then cleanup setting has no effect.

The actual logic is:

public function _beforeSuite()
{
  if ($populate) {
    if ($cleanup) {
      dropAllTables();
    }
    loadDump();
  }
}

public function _before()
{
    if ($cleanup && $populate) {
      dropAllTables();
      loadDump();
  }
}

Also they have additional conditions and only run if either dump file is non-empty or populator setting is set.

populator setting is not mentioned in Config section, but has it's own chapter right after examples.

@7118path
Copy link
Author

Thank you for having a look and specifying what actually happens.

Maybe the docs for cleanup could be like:

cleanup: false - whether the dump should be reloaded before each test, this includes the dropping of all tables

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

No branches or pull requests

2 participants