Codeception And Coverage

Hello,

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)


xdebug.remote_enable=1

xdebug.remote_handler=dbgp

xdebug.remote_mode=req

xdebug.remote_port=9000

xdebug.remote_host=127.0.0.1

xdebug.remote_autostart=0

xdebug.profiler_enable=0

xdebug.profiler_output_dir="/tmp/"

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

	</Directory>



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 127.0.0.1:36226] 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 127.0.0.1:36226] PHP Stack trace:, referer: http://localhost/myproject/

[Sun Feb 23 23:25:43.628118 2014] [:error] [pid 30646] [client 127.0.0.1:36226] 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: https://gist.github.com/perlmonkey/9641310).

It also integrates nicely with Jenkins CI :slight_smile: