Welcome Guest, Not a member yet? Register   Sign In
PHPUnit and CIUnit v0.17 doesnt work in CodeIgniter 1.7
#1

[eluser]Bogsz[/eluser]
Hi,

I have followed this link http://www.knollet.com/foostack/ for setting up CIUnitv0.17 in CI project

In the last part of the link is the following :

Quote:CIUnit tests itself

Without writing any tests, typing "phpunit CIUnitAllTests.php" from within the "YourProject/application/tests/ciunit" directory will already run a couple of tests - these make sure that CIUnit is correctly installed and works as expected.


I followed the instructions above but after executing phpunit, it displays nothing. as in empty. No results.

What could be the problem here? Please help.. Im really stuck for 3 days and I suspect that CIUnit has the problem here. Sad

I use Ubuntu 11 and PHPUnit 3.6.10.. Tried PHPUnit 3.5.15 but still the same..


UPDATE :

Found the source of the problem. It is in set_controller method in CIUnit.php

This line

Code:
self::$controllers[$controller_name] = Array(
                                                 'address' => new $controller_name(),
                                                 'models' => array()
                                            );

Quote:‘address’ => new $controller_name() line is the main problem


What could be the fix for this?

Hope someone would help me. Im really stuck Sad
#2

[eluser]Mark LaDoux[/eluser]
Check your php.ini and make sure that the line for error_reporting reads
Code:
error_reporting = E_ALL | E_STRICT

and the line for display_errors reads

Code:
display_errors = On

Restart your webserver, and the run the script again. Post the results and we can then know what is wrong.

Please do not use these settings on a production server. They are for debugging.
#3

[eluser]Bogsz[/eluser]
Hi Mark,

Did that, but still no result displayed. Sad
By the way, i execute phpunit through commandline and i think changing php.ini will still not display error since i am not in a browser. Correct me if im wrong.

In my other PC, i get it working, but in my new formatted PC, it didnt. Dont really know whats the reason.

Thanks for repyling.
#4

[eluser]Mark LaDoux[/eluser]
php.ini controls the system defaults for php interpreter, so yes, it does effect it when viewing through the web browser. There are a few options and directives that are CLI mode only, but the ones I gave you are not. Anyway, in your index.php on your CodeIgniter install, make sure ENVIRONMENT is defined as development, if you are still not getting output you can try commenting out line 21 and lines 31-47 to force it to use the global settings. Beyond that, you'll need someone that knows a whole lot more about the php interpreters configuration than I, sorry.
#5

[eluser]Bogsz[/eluser]
I think this is about CIUnit and PHPUnit because when i run a testcase not including CIUnit.php (include_once(/../CIUnit.php)) and not extending CIUnit_TestCase class, it will work


So for sure, the problem is in the CIUnit library, and i cant really figured it out.
Maybe the author of CIUnit could help.. Sad
#6

[eluser]Bogsz[/eluser]
Found the source of the problem. It is in set_controller method in CIUnit.php

This line

Code:
self::$controllers[$controller_name] = Array(
                                                 'address' => new $controller_name(),
                                                 'models' => array()
                                            );

'address' => new $controller_name() line is the main problem

What could be the fix for this?
Please help. thanks
#7

[eluser]Unknown[/eluser]
Hi guys,

I've tried using CIUnit on existing project and fails with the cause same like Brogsz. Then, I tried using CIUnit on "empty"/default codeigniter and it works. Does anyone know what the problem is?

Thank you




Theme © iAndrew 2016 - Forum software by © MyBB