In the Yii1 module of codeception the are some guide about this, all u need is to replace your http-request component with one from the plugins\framworks\yii\web\ in codeception directory. So u do not need to create Yii application in _bootstrap file, all you need is to include in yaml configuration file Yii1 module, please see docs here for more information https://github.com/C...Module/Yii1.php

Woh.. spent a few hours to figure out how it works and make to work your module.

Look. At first in order to use your module for functional and unit tests I added it in functional.suite and unit.suite config files
modules:
enabled: [..., Yii1]

So therefore I initialize and include Codeception\Module\Yii1 2 times.
$this->appSettings = require_once($this->config['appPath']); //get application settings in the entry script
$this->_appConfig = require_once($this->appSettings['config']);
when I include it next time require_once return null and it didn't work. Also I need to add Yii::setApplication(null); as you do in Codeception\Util\Connector\Yii1

First of all
$uri = str_replace('http://localhost','',$request->getUri());
$scriptName = str_replace('http://localhost','',$this->url);
What is localhost, I bet this is not correct or useless. I briefly scan the code perhaps localhost was set in
Symfony\Component\BrowserKit\Client as default. But you have to config it somehow. And definitely localhost has no relation to scriptname. But ok you can change config value and this will work.

But take a look in
if (strpos($uri,$scriptName) === false)
$uri = $scriptName.$queryString;
this is incorrect.
At this point for my example uri I have $uri = 'post/3' and $scriptName = 'index-test.php' and finally for all pages my $uri = 'index-test.php'

Thanks for comment, will review your issue and make some PR, btw did not get it, what is the problem with 2 different suites? i try to reproduce it and everything works fine. Btw. hack with $uri is for not path url-manager, so will also think how to solve it, because it must be done before application is created. Created issue on codeception, if u want can continue there https://github.com/C...tion/issues/182

Well guys there were some improvements with Yii1 module in codeception like correct handling unit-tests from the "out-of-the-box" and other important fixes that were made by Yii github users. We really appreciate your help, so test it, use it and feel free to create issues about bugs or questions

Codeception 1.5.7 is out, there are some changes in Yii1 module too. Still have some issues marked by "yii" label opened, but i think if there will be more yii users on codeception repo we will solve them. Again thanks all users that collaborate and work on yii and codeception integration

So, guys, 1.6.0 is out, thanks to contributors and DavertMik(core-developer), there are some interesting things like interactive console and other, but anyway, the one thing that must be noticed here because of Yii1 module integration is an additional option for running tests, its called --defer-flush (see this PR https://github.com/C...eption/pull/245), so because of some problems that was in Yii integration (like headers, sessions, etc), you can use this option to be sure that no output will be before some important function usage. So for IndexCept.php (with scenario from Yii1 module) it will be like this:
>php codecept.phar --steps --defer-flush run functional IndexCept.php
Also feel free to ask some questions or submit bug-issues or PR in codeception repo about Yii1 module, your help is really appreciated).

first, thanks for your work and excuse me if I start asking silly or provoking questions ... also I am not very experienced with testing.

I got similar problems like radzserg when using your module. Why did you change the index-test.php file? Like returning an array instead of creating the webapp.
Wouldn't it be better to specify the application class and config in the Yii1 module configuration and then initialize the app with these settings in the module?

And why do you need the module at all, what are your use-cases? - I asking just because it runs fine for me without the module. But I had to include the PhpBrowser module for my functional tests, is this the "slow" stuff? I still don't fully understand et the difference between acceptance and functional tests.

Best regards,
schmunk

PS: On the codeception page it states, that Codeception is the first testing suite for Yii, that's not really true, Yii always ships with a test folder and corresponding configs.

I got similar problems like radzserg when using your module. Why did you change the index-test.php file? Like returning an array instead of creating the webapp.
Wouldn't it be better to specify the application class and config in the Yii1 module configuration and then initialize the app with these settings in the module?

Well, main reason was that module must be easy-install with little config params, and some developers also has different settings in "index.php" entry scripts, so if just put only config and app class in Yii1 module config it will be wrong because some sttings in entry scripts will not be applied.

Quote

And why do you need the module at all, what are your use-cases? - I asking just because it runs fine for me without the module.

yes, correct, module was designed and written about 3 months ago so in that time functional tests were tests that can be run without server only through symfony browser-kit, codeception works fine through borwser-kit with symfony2 integrations as i know and with Kohana/Zend integrations too, so module for Yii1 was created with those reasons.

Quote

But I had to include the PhpBrowser module for my functional tests, is this the "slow" stuff?

right, i also use PhpBrowser for functional tests, it is not so fast as use only integration with browser-kit, but it is faster than selenium tests. So you are correct here to use it for functional tests.

Quote

I still don't fully understand et the difference between acceptance and functional tests.

well the main difference is that acceptance tests do not know anything about application inner code (if we talking about functional tests you can use for them also some modules like FileSystem). So the main difference on testing web-pages is that selenium tests are very slow, and phpbrowser test are much faster, thats why you prefer phpbrowser for functional tests to cover some basic functionality, and some functionality that not covered by functional tests (with phpbrowser)will be covered with acceptance tests (with Selenium2). As for me my functional tests (lets say 10 of them, differen tests, some of them of course CRUD-tests) can run in 50 sec. when acceptance tests will take a 4-5 minute at least.

BTW. the difference beetwen new Cests-forman and Cepts is that Cests are more like phpunit-selenium tests i think, in Cests you have _before/_after/_failed methods to manage your fixtures or smth. else, and cepts are only flat-files scenarios, so when u test some CRUD-functionality you can write 1 long cept, or you can use new Cest format, with same verbose level and user (TestGuy\WebGuy) and split each of (CRUD) in separate method.

Quote

PS: On the codeception page it states, that Codeception is the first testing suite for Yii, that's not really true, Yii always ships with a test folder and corresponding configs.

Looks like some misunderstanding, ofcourse Yii has out-of-the-box support for phpunit tests, can you please point where is this written will change it of course.

So, I downloaded codeception.phar into the root of my yii application.
Now what?
functional.suite.yml - I have to create that myself?
In the root folder?

I don't quite get the thing about You need to use CodeceptionHttpRequest from plugins directory (plugins\frameworks\yii\web),..
Do I tell Yii about this in what config? and how?
test.php in protected/config?

I will do some more testing tomorrow when I am less dense, but I think the docs could be greatly improved.

Also, remember: Phundament is Schmunk's framework, it's not vanilla Yii, so any guides from it is rather irrelevant (but maybe helpful).

I also think that maybe you can use PhpBrowser it set more request headers and other params because it involves server, for now i am not using Yii1 module and switched to PhpBrowser for functional tests because of some problems with cyrillic and not-standart symbols in Yii1 module. PhpBrowser also as fast as tests with symfony browser kit with Yii1 module.

I briefly toyed with the idea of using composer, but .. you know, it's just a simple wget and that's it.

I gave up, actually.
I accidentally ran the sample code for Yii as acceptance test and it gave me an OK, even though none of the tests were actually true.
And then I ran into db issues, etc.
But might tackle it again.

The documentation is really scarce, and assumes a lot of things (like prior exposure to Codeception, which is silly, actually), I also looked at your setup, but it didn't work. Mainly due to db failures..

I see that you are using a dump.sql file?
I might try that.
Does it work against MySQL?

I am using fixtures in Yii, but that doesn't seem to work with Codeception.
I will probably use a data mock library/tool and generate a test db.

One last thing: do you need to set up the PHP 5.4 browser? From php.ini, I mean?

@Ragazzo:
I've heard that you are writing a survival guide.
That sounds great.