I'm testing Symfony4 new directory structure with Coception.
Codeception is installed and configured. Because of the end of bundle strategy, I known that an error will occured and here is the error:
PHP Fatal error: Uncaught Error: Class 'Kernel' not found in
...\my_project\vendor\codeception\codeception\src\Codeception\Module\Symfony.php:146
Codeception don't find Kernel class, because of its new namespace which is App and not an empty namespace.
Kernel is now in the src directory and declared in the App namespace.
The new Kernel declaration
<kbd>src/Kernel.php</kbd>
namespace App; // <-- the namespace
[...]
class Kernel extends BaseKernel[...]
Previously, Kernel was named AppKernel and didn't have namespace:
The old Kernel declaration
<kbd>app/AppKernel.php</kbd>
<?php
//no namespace
[...]
class AppKernel extends Kernel
I edited the 265th line of the Symfony.php
file to change this line which is returning Kernel
:
$class = $file->getBasename('.php');
by this line to return App\Kernel
:
$class = 'App\\'.$file->getBasename('.php');
This modification forces the new namespace of the new structure.
My functional tests run perfectly, but I want to avoid modification in vendor file.
How can I force the App namespace without this hack? It seems there is no parameter to do it, but can I encapsulate codeception in the app namespace or find a hack to put it in my files, not in the vendor file?