Open ahmedtoolapp opened 4 years ago
Have you solved this issue @ahmedtoolapp ?
This error means that the bootstrap file isn't loaded. Indeed, the boostrap.php
is responsible to load the Symfony's DotEnv component.
Therefore, have a look at your behat.yml
file and make sure that the bootstrap file path is correctly configured.
Eg:
extensions:
Behat\Symfony2Extension:
kernel:
bootstrap: features/bootstrap/bootstrap.php
class: App\Kernel
@ And how to connect Database ? How it looks like in FeatureContext ? function () { new Kernel ....
For what it's worth, I've stumbled upon this issue too and using the comment of @mtarld I got it fixed (I was working on a symfony 6.4 to symfony 7 upgrade)
The error
In EnvVarProcessor.php line 217:
[Symfony\Component\DependencyInjection\Exception\EnvNotFoundException]
Environment variable not found: "MYSQL_HOST".
The fix
FriendsOfBehat\SymfonyExtension:
- path: src/App/Kernel.php
+ path: tests/bootstrap.php
contents of bootstrap.php
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
require dirname(__DIR__).'/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}
I am using Symfony2Extension with a new installation of Symfony 5.1 with PHP 7.3 I tried to launch vendor/bin/behat
I have my feature displayed but with an error