Skip to content

Conversation

@greg-1-anderson
Copy link
Member

Continuation of #3815

…ences to any external Drush classes from boot object; keep Drupal bootstrap state only.
… bootstrap manager, so that we can save all state about the bootstrapped site in the bootstrap object. If this worked, then we would be able to run the Drush preflight multiple times in the integration tests, and re-inject the bootstrap object to recapture the 'state' of the Drupal bootstrap. There are two impediments to this: 1. we inject the Drupal-dependent commands as part of the bootstrap. 2. we inject a Drush logger object into Drupal. These problems might be overcome with further refactoring, but I am not going to continue with this experiment for the time being.
… tests now that bootstrap object is cached, and preflight is done for every call to Drush.
tests/README.md Outdated
- Unit tests operate on functions that take values and return results without creating side effects. No database connection is required to run these tests, and no Drupal site is set up.
- Integration tests set up a test dependency injection container and operate by calling the Symfony Application APIs directly. A Drupal site called the System Under Test is set up and used for the tests. The SUT is set up and installed only once, and then is re-used for all tests. Integration tests therefore cannot make destructive changes to the SUT database. Also, Drupal is bootstrapped only once (always using the standard Drupal kernel, never the install or update kernel), and the Drush preflight runs only once. This means that all commands run at BOOTSTRAP_FULL, and it is not possible to test loading different Drush configuration files and so on. It is not possible to test backend mode or argument / option parsing. The shutdown and error handlers are not installed, so PHP deprecation warnings will be evidenced in the integration tests.
- Integration tests set up a test dependency injection container and operate by calling the Symfony Application APIs directly. A Drupal site called the System Under Test is set up and used for the tests. The SUT is set up and installed only once, and then is re-used for all tests. Integration tests therefore cannot make destructive changes to the SUT database. Also, Drupal is bootstrapped only once (always using the standard Drupal kernel, never the install or update kernel). This means that all commands run at BOOTSTRAP_FULL, and it is not possible to test loading different Drush configuration files and so on. It is not possible to test backend mode or argument / option parsing. The shutdown and error handlers are not installed, so PHP deprecation warnings will be evidenced in the integration tests.
- Functional tests operate by `exec`ing the Drush executable. All functional tests therefore run in their own separate processes. The Drupal System Under Test is set up every time it is needed by any functional test. It is therefore okay if a functional test changes the state of the SUT.
Copy link
Member

Choose a reason for hiding this comment

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

The Drupal System Under Test is set up every time it is needed by any functional test. It is therefore okay if a functional test changes the state of the SUT.

I would say "...is installed every time ... changes the state of the database." The SUT codebase is reused so its fine to change te DB but not the codebase.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is possible to change the codebase in non-destructive ways, e.g. to add the woot module. However, it is my thought that we should just add the woot module and the SUT site aliases to the repository, and not copy them in every time.

Copy link
Member

@weitzman weitzman Dec 10, 2018

Choose a reason for hiding this comment

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

Well, I think test should clean up after themselves when they do enable a module.

  1. OK to enable woot to the SUT.
  2. I think the issue with adding site aliases is that they have full paths and those won't be the same on everyone's machine.

* 'dev' and 'stage', and bootstrap Drupal ONCE. All integration tests
* will run in this same bootstrapped environment in the same phpunit
* process, and must not do anything to damage or alter it.
* UnishIntegrationTestCase will prepare a single of Drupal site,
Copy link
Member

Choose a reason for hiding this comment

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

single of Drupal

typo

@greg-1-anderson greg-1-anderson merged commit fc6205a into master Dec 10, 2018
@weitzman weitzman deleted the better-bootstrap-refactor branch March 11, 2019 13:40
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