-
Notifications
You must be signed in to change notification settings - Fork 39
yiiLogger
not initialized when ChromeDriver fails, causing error
#131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Try this config:
|
Could you test this branch? #132
I don't think the issue is related to configuration. |
Yes, indeed. The configuration doesn't affect it. I'd like to get your thoughts on this line. https://github.com/Codeception/module-yii2/blob/v2.0.3/src/Codeception/Module/Yii2.php#L377 |
Read the comments above the file: https://github.com/Codeception/module-yii2/blob/v2.0.3/src/Codeception/Module/Yii2.php#L32 The line is needed; removing it changes the behavior in several ways and is not a solution. |
fix: fixes #131 yiilogger may not be initialized in _failed
Description:
When running tests using Codeception with the Yii2 module, if ChromeDriver fails, such as in the following case:
It leads to an error in the test execution. The issue is related to the instantiation of
yiiLogger
in the_before
event, but it is being accessed in the_failed
event before being properly initialized in case of failure. Specifically, insrc/Codeception/Module/Yii2.php
, the following code is used in the_failed
event:But in the
_before
method,yiiLogger
is instantiated as follows:If ChromeDriver fails before the
_before
event is executed, theyiiLogger
is never initialized, and accessing it in_failed
results in the following error:Steps to reproduce:
Typed property Codeception\Module\Yii2::$yiiLogger must not be accessed before initialization
occurs.Expected behavior:
The
yiiLogger
should be properly initialized before being accessed, or there should be a check to ensure that it is only accessed if initialized. A more graceful handling of the failure, such as skipping the logging in case of initialization failure, would avoid this issue.The text was updated successfully, but these errors were encountered: