Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

[SOLVED] Please install PHPUnit using pear


Reply


8 Posts   2664 Views

Avatar
chrclaus

Community Member, 29 Posts

27 January 2011 at 6:22am

Hello,

I want to write testcases but I am not able to get PHPUnit started. I searched this and other forums and read different installation manuals. I checked the config and path entries but by calling http://localhost/dev/tests in my browser I get the error

Please install PHPUnit using pear


Using phpunit in command line mode without any parameters I get the usage informations. Calling

phpUnit sapphire/tests/


shows me the error

sapphire/tests/.php could not be found or is not readable

I´m using xampp 1.7.0 (Apache 2.2.11 and PHP 5.2.8 MySql 5.1.30) on WindowsXP.

I checked the config-files php.ini and pear.ini several times but I did not find any inconsistence between the manual, forum entries and my config. Can anybody help me?

Best regards,
chrclaus

Avatar
Willr

Forum Moderator, 5513 Posts

27 January 2011 at 11:57am

To run the tests you should use sake or via a webbrowser hitting the url http://yoursite.com/dev/tests/ or sake dev/tests. Running the tests directly through phpunit is something Ingo has just got working, don't know if this has made general release yet though!

Avatar
chrclaus

Community Member, 29 Posts

27 January 2011 at 8:28pm

Hi Willr,

this was my first guess but I am receiving the error

Please install PHPUnit using pear

After this I tried out other possibilities to verify PHPUnit. But running the tests via browser is the way I want to use.

Best regards,
chrclaus

Avatar
Willr

Forum Moderator, 5513 Posts

28 January 2011 at 9:35am

What happens if you call the following in your terrminal window

PHPUnit --version

If PHPUnit is not available then it may not have been installed correctly. Try following the installation steps again - from http://doc.silverstripe.org/sapphire/en/topics/testing

Avatar
chrclaus

Community Member, 29 Posts

29 January 2011 at 1:09am

Hi Willr,

C:\xampp>phpunit --version
PHPUnit 2.3.6 by Sebastian Bergmann.

C:\xampp>

I followed these installation steps several times, but the result remains the same: -> Please install PHPUnit using pear

Best regards,
chrclaus

Avatar
Willr

Forum Moderator, 5513 Posts

30 January 2011 at 5:14pm

It is possible that your PHPUnit is too old for SilverStripe. I'm using 3.4.3 so 2.3.6 must be quite old.

Avatar
chrclaus

Community Member, 29 Posts

1 February 2011 at 2:40am

Hi Willr,

that´s it! A missing channel blocked the whole update. After fixing the channel-config and upgrading to PHPUnit-version 3.5.10 I´m able to run tests. Thank you very much.

Best regards,
chrclaus

Avatar
wildflower1975

Community Member, 59 Posts

8 July 2011 at 12:18pm

I'm using Ubuntu and had to run
<code>
sudo apt-get install phpunit
</code>
instead of installing it via pear to get it to work

HTH