Closed maxailloud closed 2 years ago
Is this something needed for this PR to be merged?
Maybe the question is "is this check about a bundle still usefull ?" In sf4, application could be outside of a bundle, so we maybe need to remove this check.
That is exactly why I added this flag, for bundleless Symfony application. Because without it, or something similar, the root folder is not properly loaded and the tests not found.
I know that this PR is pretty old, but symfony 4 compatibility is not resolved.
When we add atoum bundle with composer, it doesn't work :
Script cache:clear returned with error code 1
!!
!! In DebugClassLoader.php line 193:
!!
!! Case mismatch between loaded and declared class names: "atoum\AtoumBundle\a
!! toumAtoumBundle" vs "atoum\AtoumBundle\AtoumAtoumBundle".
!!
!!
!!
Script @auto-scripts was called via post-update-cmd
We need to modify project config/bundles.php
:
Before : atoum\AtoumBundle\atoumAtoumBundle::class => ['dev' => true, 'test' => true],
After : atoum\AtoumBundle\AtoumAtoumBundle::class => ['dev' => true, 'test' => true],
=> I don't know how to modify this at installation, my only contribution could be documentation
The console atoum command doesn't work : it will be resolved by this PR with the explicit declaration of it in configuration.xml
The AtoumCommand class extends ContainerAwareCommand
that is deprecated. It will be easy to replace by extends Command
with dependency injection.
The ControllerTest doesn't work : it search the Kernel class in app
directory. And even if we change this by searching in src
directory, that doesn't work (I think because Kernel class has now a namespace). The solution is to overload getKernelClass
in our own test (via abstract class by example)
protected function getKernelClass()
{
return 'App\Kernel';
}
Maybe it will be good to add this in the documentation.
I can make a PR with all of these points, even if the second can be resolved by @maxailloud work.
Add
is_bundle
option in the bundle configuration to be able to launch tests from a bundle-less application.I don't know if it's the best way to go for it, but that's the solution I found at least. I did the minimum necessary to make it work.