Problem/Motivation

TestBase::prepareEnvironment currently builds a minimalistic container with the following services populated manually:

  • language.default_values (parameter)
  • language.default
  • language_manager
  • string_translation
  • info_parser
  • request
  • current_user

The language-related services are marked with a @todo: Remove this once this class has no calls to t() and format_plural().

In fact the container populated by TestBase remains virtually unused because most of the test-classes either inherit from KernelTestBase or WebTestBase. These base classes replace the container with one which is fully functional.

Proposed resolution

  • Remove all services from the TestBase container.
  • Rebase tests which currently extend TestBase directly but still require the string_translation service to KernelTestBase. I.e.: [...]\Common\SizeUnitTest, [...]\Plugin\Discovery\DiscoveryTestBase, [...]\Plugin\PluginTestBase

Remaining tasks

Review.

User interface changes

None.

API changes

None.

Comments

znerol’s picture

Status: Active » Needs review
StatusFileSize
new632 bytes
znerol’s picture

Issue summary: View changes
znerol’s picture

StatusFileSize
new2.72 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2275965-no-services-in-test-base.patch, failed testing.

znerol’s picture

Status: Needs work » Needs review
StatusFileSize
new6.53 KB
new4.03 KB
znerol’s picture

Title: Remove the current_user service from the TestBase container » Remove the all services from the TestBase container
Issue summary: View changes
znerol’s picture

Title: Remove the all services from the TestBase container » Remove the services from the TestBase container
znerol’s picture

Title: Remove the services from the TestBase container » Remove all services from the TestBase container
znerol’s picture

Issue summary: View changes
znerol’s picture

sun’s picture