How to use PHPUnit (CIUnit) with CodeIgniter 2.1.0 |
[eluser]kenjis[/eluser]
I wrote a tutorial about how to install and use PHPUnit/CIUnit with CodeIgniter 2.1.0. http://d.hatena.ne.jp/Kenji_s/20120117/1326763908
[eluser]ShipSailingHome[/eluser]
Kenji, I'm pretty new to PHPUnit. I've followed the instructions at this URL http://d.hatena.ne.jp/Kenji_s/20120117/1326763908 -- and I'm getting an error. I didn't download a fresh copy of CodeIgniter, like in your tutorial, because I already have my project built. I'm hoping you can advise me. I keep getting this error: Code: controllers fixtures generate generate.php getops.php helpers libs models phpunit.xml system Thinking I had the PHPUnit files in the wrong place, I made a symlink in my CI web root: Code: bob@dev1:~/zbb-dev/zbb$ ls But I'm still having the same problem. Maybe my PHPUnit install is just bad?
[eluser]ShipSailingHome[/eluser]
It looks like I'm using an older version of PHPUnit that doesn't include Autoload.php . It has Framework.php instead. That's disappointing because the newer version of PHPUnit requires a newer version of PHP -- and, I can't upgrade PHP on this server.
[eluser]ShipSailingHome[/eluser]
I couldn't upgrade to a newer version of PHP on that server, but I got access to a server that I could upgrade PHP on ![]() I got it working! Woohoo!
[eluser]jessejimz[/eluser]
Hey, Keinji -- I think I know your cousin in MX (Kenji S.). In any event, I'm on a Mac OS X + XAMPP + Eclipse Helios + CodeIgniter v2.0.3. I got everything running well via command terminal and really digg CIUnit. I'm so happy you spent valuable time creating this. Man, I cannot tell you how many hours I have spent tryting to get Makegood plugin for Eclipse working with CIUnit on my Mac. I keep getting this "CIUnit_TestCase_Selenium class is not available. Fix..." error that I can't get rid of. My checklist of things I ensured: * I Have PHP 5.3.x installed * I have latest PHPUnit 3.7 installed via PEAR * I have PHPUnit Selenium installed via PEAR * I have the PEAR path in my Eclipse project's include path (PEAR is up to date) * Installed latest Makegood plugin for Eclipse (works fine with PHPunit) * I properly set up Makegood settings for CIUnit * My environment variables are set in my .profile and have the XAMPP bins there (it's why I can actually run CIUnit from command line) Have you gotten any reports about this pesky problem with Makegood? I know it has to do with dependency resolution by Makegood/Eclipse. Any help much appreciated.
[eluser]kenjis[/eluser]
[quote author="jessejimz" date="1327285111"] Man, I cannot tell you how many hours I have spent tryting to get Makegood plugin for Eclipse working with CIUnit on my Mac. I keep getting this "CIUnit_TestCase_Selenium class is not available. Fix..." error that I can't get rid of. My checklist of things I ensured: * I Have PHP 5.3.x installed * I have latest PHPUnit 3.7 installed via PEAR * I have PHPUnit Selenium installed via PEAR * I have the PEAR path in my Eclipse project's include path (PEAR is up to date) * Installed latest Makegood plugin for Eclipse (works fine with PHPunit) * I properly set up Makegood settings for CIUnit * My environment variables are set in my .profile and have the XAMPP bins there (it's why I can actually run CIUnit from command line) Have you gotten any reports about this pesky problem with Makegood? I know it has to do with dependency resolution by Makegood/Eclipse. Any help much appreciated. [/quote] Your checks seem to be good. But, what is "CIUnit_TestCase_Selenium class" ? I think there is no such class. I have not installed PHPUnit Selenium, but MakeGood works fine.
[eluser]philpalmieri[/eluser]
Kenji, you rock! this is awesome and works great, thank you. I added a webtest folder, and selenium and it works perfectly
[eluser]rubdottocom[/eluser]
Hi! Whoah Kenji, thanks for the amazing work! I'm close to make it work, I have a problem with a simple test of a controller This is my controller Code: <?php And this my test: Code: <?php When I run phpunit I receive 404 Message because the Code: if ( ! file_exists('application/views/pages/'.$page.'.php')) But the file exists and if I try to open in a browser works fine, I miss something? :-(
[eluser]kenjis[/eluser]
[quote author="rubdottocom" date="1328701352"]Hi! Whoah Kenji, thanks for the amazing work! I'm close to make it work, I have a problem with a simple test of a controller This is my controller Code: ...snip... ...snip... When I run phpunit I receive 404 Message because the Code: if ( ! file_exists('application/views/pages/'.$page.'.php')) But the file exists and if I try to open in a browser works fine, I miss something? :-([/quote] Probably because you are pointing your view file as relative path. Please change the path as absolute path. For example: APPPATH.'views/pages/'.$page.'.php'
[eluser]rubdottocom[/eluser]
[quote author="Kenji @ CodeIgniter Users Group in Japan" date="1328702847"][quote author="rubdottocom" date="1328701352"]Hi! Whoah Kenji, thanks for the amazing work! I'm close to make it work, I have a problem with a simple test of a controller This is my controller Code: ...snip... ...snip... When I run phpunit I receive 404 Message because the Code: if ( ! file_exists('application/views/pages/'.$page.'.php')) But the file exists and if I try to open in a browser works fine, I miss something? :-([/quote] Probably because you are pointing your view file as relative path. Please change the path as absolute path. For example: APPPATH.'views/pages/'.$page.'.php' [/quote] Works perfect :- ) I'm pretty newbie with CI and php ^^u |
Welcome Guest, Not a member yet? Register Sign In |