19

I installed PHPUnit using the PEAR installer a few days ago (I also installed Selenium RC for testing in PHP purpose). Now I want to uninstall it (also delete all related folders and files)

I ran the following command:

pear uninstall phpunit/PHPUnit

and the console displayed:

phpunit/PHPUnit not installed

I checked the PHPUnit folder, it was still there?

Was it uninstalled? I try to reinstall a new PHPUnit, but the console displayed:

No releases available for package "pear.phpunit.de/PHPUnit"

How can I reinstall it?


Here's the output of pear list -c pear.phpunit.de:

pear list -c pear.phpunit.de

Here's output of pear list -c pear.phpunit.de:

pear list -c pear.phpunit.de

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
Leo Lerdorf
  • 1,304
  • 4
  • 15
  • 19
  • What does `pear list -c pear.phpunit.de` show? – Álvaro González Jan 05 '12 at 09:18
  • @ÁlvaroG.Vicario: You can see the image here http://farm8.staticflickr.com/7034/6640174409_a7d13f8ff8.jpg – Leo Lerdorf Jan 05 '12 at 09:26
  • Console's output is text. You could have just pasted it here. :) – Álvaro González Jan 05 '12 at 09:31
  • @ÁlvaroG.Vicario: sorry, the above picture is for the command: pear remote-list -c phpunit. for the command: pear list -c pear.phpunit.de. the picture is: http://farm8.staticflickr.com/7150/6640195767_4894dc7bd9.jpg – Leo Lerdorf Jan 05 '12 at 09:35
  • ok, here is the text:
    >C:\>pear list -c pear.phpunit.de
    >INSTALLED PACKAGES, CHANNEL PEAR.PHPUNIT.DE:
    ============================================
    PACKAGE VERSION STATE File_Iterator 1.3.0 stable PHPUnit_MockObject 1.1.0 stable PHP_CodeCoverage 1.1.1 stable PHP_Timer 1.0.2 stable PHP_TokenStream 1.1.1 stable Text_Template 1.1.1 stable
    – Leo Lerdorf Jan 05 '12 at 09:39
  • Why is this suggest off-topic to *webmasters*? – hakre Jan 05 '12 at 09:44
  • I've updated the question for you. – Álvaro González Jan 05 '12 at 09:59

2 Answers2

12

I checked the PHPUnit folder, it was still there?

That might be because of sub-components (Extensions, Framework). However you must not be concerned about that.

To install the latest version, do the following two commands:

> pear config-set auto_discover 1
config-set succeeded

> pear upgrade
...

This will take some time, and will update all that is currently installed. As you have some extensions already available and the latest version of PHPUnit might require those, so update them to prevent failure in the next command:

> pear install pear.phpunit.de/PHPUnit

This should now install it:

Did not download optional dependencies: phpunit/PHP_Invoker, use --alldeps to download automatically
phpunit/PHPUnit can optionally use package "phpunit/PHP_Invoker" (version >= 1.0.0)
downloading PHPUnit-3.6.7.tgz ...
Starting to download PHPUnit-3.6.7.tgz (118,349 bytes)
..........................done: 118,349 bytes
install ok: channel://pear.phpunit.de/PHPUnit-3.6.7

Troubleshooting PEAR

As you reported in comments, this did not work out. Probably pear is in a state that it does not know where top and bottom is. Time to force. First, clear the cache:

> pear clear-cache
reading directory C:\...\Temp\pear\cache
0 cache entries cleared

Then force channel updates:

> pear channel-update -f pear.php.net
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded

> pear channel-update -f pear.phpunit.de
Updating channel "pear.phpunit.de"
Update of Channel "pear.phpunit.de" succeeded

Then force the phpunit install:

> pear install -a -f phpunit/PHPUnit
hakre
  • 193,403
  • 52
  • 435
  • 836
  • I took your guide but at the second command (pear install pear.phpunit.de/PHPUnit) the console still displayed as the last time: No releases available for package "pear.phpunit.de/PHPUnit" install failed – Leo Lerdorf Jan 05 '12 at 10:10
  • okay, that's borked. Edorian posted something for windows, let me search for that answer. – hakre Jan 05 '12 at 10:13
  • @LeoLerdorf: I extended the answer. A related question is [Windows Installing PHPUnit via PEAR - Installing PHPUnit via PEAR](http://stackoverflow.com/q/6272264/367456). – hakre Jan 05 '12 at 10:22
  • @zerkms: Which off all have you tried? If you want come to PHP chat and/or create a new question where you outline your issue. – hakre Dec 30 '12 at 21:01
  • @hakre: well, I've found that it also depends on php version (though it doesn't state it explicitly) – zerkms Dec 30 '12 at 21:02
  • @zerkms: Well which PHP versions you talk about specifically? – hakre Dec 30 '12 at 21:03
  • @zerkms: Doesn't have PHP 5.3.2 known bugs? I mean I would not expect that to work actually. – hakre Dec 30 '12 at 21:07
6

As Google referenced this question as "how to REMOVE it", it seems important to answer the question.

As root, use:

pear list -c phpunit | grep stable | awk '{print "phpunit/"$1}' | xargs pear uninstall

Found this answer here

Alain Tiemblo
  • 36,099
  • 17
  • 121
  • 153