contao / test-case

[READ-ONLY] Contao Test Case
6 stars 4 forks source link

Consider integrating contao/test-case into the core again #10

Closed m-vo closed 3 years ago

m-vo commented 3 years ago

IMHO methods like TestCase#getContainerWithContaoConfiguration() are closely tied to the codebase and should live in the mono repo as well. To me most things in this repo should either be more abstract or not be reusable at all (because Tests should not be designed to be reusable, nor covered from a BC promise).

Example

In newer versions of contao/contao we have to add definitions like request_stack and contao.security.token_checker to the test container, so that using the legacy framework works.

$container = $this->getContainerWithContaoConfiguration();

$container->set('request_stack', $this->createMock(RequestStack::class));
$container->set('contao.security.token_checker', $this->createMock(TokenChecker::class));

System::setContainer($container);

We could oc add this to the test case in a certain version but IMHO we should consider integrating the bundle into the core again.

leofeyer commented 3 years ago

The point of the test-case package is that people are supposed to be able to use it in their custom installations/extensions, too. Because when you write tests for a Contao installation/extension, you are likely to need a container with the Contao configuration.

m-vo commented 3 years ago

I know but that still does not solve the problem... I had the thought if we should rather allow specific reusable things in the core-bundle (that you would require anyway in this case), i.e. explicitly include them in the BC promise.

Does Symfony have any reusable test components?

leofeyer commented 3 years ago

As discussed in Mumble on February 11th, we want to keep the test case as separate package, so we can release new major versions with BC breaks without having to wait for Contao 5.