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
"_initialize" method of any module called twice #582
Comments
please, do attach your config |
You can try to reproduce this using Codeception own tests. Add After they finished, you might see that "foo.txt" contains two lines of text instead of one. |
Wow, that's a strong argument :) Strange thing that we do strict check of all module callbacks to be executed in right order. You might see a test for those there too. Anyway, thanks. I will try to investigate it. |
Nah, did not reproduce it. I added to CliHelper <?php
function _initialize()
{
file_put_contents("foo.txt", "bar\n", FILE_APPEND);
}
?> Just as you said. Then I ran ANd I got |
Hmmm... Sorry for wasting your time. Probably, I was incorrect. If I reproduce this situation, I'll give you more info and reopen the issue. |
I have same problem. #This is a acceptance.suite.dist.yml
class_name: WebGuy
modules:
enabled:
- PhpBrowser
- WebHelper
config:
PhpBrowser:
url: 'http://localhost/' & #This is a acceptance.suite.yml
class_name: WebGuy
modules:
enabled:
- PhpBrowser
- WebHelper
config:
PhpBrowser:
url: 'http://test.local/' & <?php
#This is a WebFormsAvailableCept.php
$I = new WebGuy($scenario);
$I->am('Web client');
$I->wantTo('Ensure that form available');
$I->amOnPage('/home/form.php');
$I->seeElement('form#form_online'); see below output of run command /c/wamp/apps/test (codeception)
$ php codecept.phar run
Codeception PHP Testing Framework v1.8.0.1
Powered by PHPUnit 3.7.28 by Sebastian Bergmann.
Acceptance Tests (1) -------------------------------------------------------
Trying to ensure that form available (WebFormsAvailableCept.php) Fail
----------------------------------------------------------------------------
Acceptance Tests (1) -------------------------------------------------------
Trying to ensure that form available (WebFormsAvailableCept.php) Fail
----------------------------------------------------------------------------
Functional Tests (0) ------------------------
---------------------------------------------
Unit Tests (0) ------------------------------
---------------------------------------------
Time: 535 ms, Memory: 20.50Mb If I remove acceptance.suite.dist.yml file, or run only acceptance suite - tests will be execute only once. /c/wamp/apps/test (codeception)
$ php codecept.phar run acceptance
Codeception PHP Testing Framework v1.8.0.1
Powered by PHPUnit 3.7.28 by Sebastian Bergmann.
Acceptance Tests (1) -------------------------------------------------------
Trying to ensure that form available (WebFormsAvailableCept.php) Fail
----------------------------------------------------------------------------
Time: 213 ms, Memory: 19.25Mb |
With introducing of global configuration file, we got extra calling of
_initialize
hook of any registered module, and that can lead to invalid or unwanted behaviour: for example, cleanup and populating of a database withDb
module will be performed twice.As a workaround, for now I run my migrations and data importing from within global bootstrap file.
This need to be fixed. Codeception must provide some information about type of configuration file to the method.
The text was updated successfully, but these errors were encountered: