Codeception And Coverage


I start a fresh post to separate this "issue" from the other codeception related topic.

As stated before, I use basic template (with no modification). Codeception tests work well, except when I try to activate code coverage.

Part of my problems came from xdebug, php and apache configuration.

I had errors like :

file_get_contents(http://localhost/myproject/c3/report/clear): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

Here is how I solved it :

xdebug configuration (I put it in /etc/php5/mods-available/xdebug.ini)









php configuration (in /etc/php5/apache2/php.ini)

output_buffering = Off

apache configuration

	Alias /myproject/ /home/jbcrouigneau/myproject/

	<Directory /home/jbcrouigneau/myproject>

		Options Indexes FollowSymLinks MultiViews

		AllowOverride None

		Order allow,deny

		allow from all


and in mods-enabled/mime.conf

AddType application/x-httpd-php .php

Not sure if every single lines are required, but that is how I made http://localhost/myproject/c3/report/clear works.

But coverage still doesn’t work for acceptance tests.

[Sun Feb 23 23:25:43.627871 2014] [:error] [pid 30646] [client] PHP Fatal error:  Cannot redeclare class Yii in /home/jbcrouigneau/myproject/vendor/yiisoft/yii2/Yii.php on line 6, referer: http://localhost/myproject/

[Sun Feb 23 23:25:43.628045 2014] [:error] [pid 30646] [client] PHP Stack trace:, referer: http://localhost/myproject/

[Sun Feb 23 23:25:43.628118 2014] [:error] [pid 30646] [client] PHP   1. {main}() /home/jbcrouigneau/myproject/web/index-test.php:0, referer: http://localhost/myproject/

Any help welcomed ! Otherwise, maybe, to be continued…

Although I am not using Yii 2 I have put Yii 1 and Codeception 2.0.0-alpha to work together and after a lot (!) of small and big issues finally got it working properly with my setup (you can see it in my gist:

It also integrates nicely with Jenkins CI :slight_smile: