How do I correctly install PHPUnit with PEAR?

前端 未结 8 782
甜味超标
甜味超标 2021-01-31 08:22

I have had to de- and reinstall a newer version of PHPUnit following these directions. Now when I\'m launching this line

sudo pear install --alldeps phpunit/PHPU         


        
相关标签:
8条回答
  • 2021-01-31 08:34

    Following Plínio César, I solved it finally, but with slight variation:

    First I did a "sudo apt-get remove phpunit" to remove the faulty installation. Then using pear to do the phpunit installation:

    sudo pear install pear.symfony.com/Yaml

    sudo pear channel-discover pear.phpunit.de

    sudo pear config-set auto_discover 1

    sudo pear install --alldeps pear.phpunit.de/PHPUnit

    Thanks Plinio Cesar!!!

    0 讨论(0)
  • 2021-01-31 08:35

    I had the same problem while upgrading my phpunit.

    This solved the problem:

    pear channel-discover pear.symfony.com
    pear install pear.symfony.com/Yaml
    

    Then run:

    pear install --alldeps pear.phpunit.de/PHPUnit
    

    OBS: I think the pear install pear.symfony.com/Yaml is not necessary. I'm just posting it because it is exactly the way I solved my problem.

    0 讨论(0)
  • 2021-01-31 08:36

    Process mentioned by PutzKipa works however you might need super user privileges. For ubuntu add sudo before each command.

    0 讨论(0)
  • 2021-01-31 08:36

    The easiest way to obtain PHPUnit in Ubuntu, Debian, Fedora or OpenSUSE is to download a PHP Archive (PHAR) that has all required (as well as some optional) dependencies of PHPUnit bundled in a single file.

    Open the terminal and type:

    wget https://phar.phpunit.de/phpunit.phar  # download the PHP Archive (PHAR) file  
    chmod +x phpunit.phar   
    sudo mv phpunit.phar /usr/local/bin/phpunit   
    

    There are many different versions of phpunit.phar at https://phar.phpunit.de/. If you use the first command, it will select and download the latest version.

    Note: The /usr/local/bin/ path in the last command is correct for Ubuntu, Debian, Fedora and OpenSUSE distributions and also for other Linux distributions that have a /usr/local/bin/ directory.

    Reference: What is /usr/local/bin? Came across it in an script installation for Applescript but would like to know more

    0 讨论(0)
  • 2021-01-31 08:39

    I also had this error message:

    Unknown remote channel: pear.symfony.com

    Solved creating an alias:

    pear channel-alias pear.symfony-project.com pear.symfony.com
    

    and then

    channel-discover pear.symfony-project.com
    
    sudo pear channel-discover components.ez.no
    
    sudo pear update-channels
    
    sudo pear upgrade-all
    
    sudo pear install --force --alldeps phpunit/PHPUnit
    
    0 讨论(0)
  • 2021-01-31 08:46

    Use this, as described in the PHPUnit docs: (i don't what sudo means, this is how I do it on a windows PC):

    pear config-set auto_discover 1
    pear install pear.phpunit.de/PHPUnit
    
    0 讨论(0)
提交回复
热议问题