Skip to content

Instantly share code, notes, and snippets.

@fomigo
Forked from pjkelly/installer.sh
Created June 23, 2012 13:16
Show Gist options
  • Save fomigo/2978278 to your computer and use it in GitHub Desktop.
Save fomigo/2978278 to your computer and use it in GitHub Desktop.
Installing PHPUnit via Pear on Ubuntu Lucid
# Uninstall any pre-existing packaged
# versions of phpunit
sudo apt-get remove phpunit
# Install pear via apt-get
sudo apt-get install php-pear
# Update existing pear channels
sudo pear channel-update pear.php.net
# Upgrade all existing pear elements
sudo pear upgrade-all
# Discover channels necessary to install
# PHPUnit and its dependencies
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
# Force install of HTTP_Request2 because it's
# currently in RC status and pear won't install
# those by default
sudo pear install -f HTTP_Request2-2.0.0RC1
# Install PHPUnit
sudo pear install -a phpunit/PHPUnit-3.5.14
# Check to see if everything's cool.
phpunit --version
def phpunit
package "phpunit", :ensure => :absent
package "php-pear", :require => package('php5')
exec "pear-channel-update", :command => "sudo pear channel-update pear.php.net", :require => package("php-pear")
exec "pear-upgrade-all", :command => "sudo pear upgrade-all", :require => exec("pear-channel-update")
required_channels = %w(pear.phpunit.de pear.symfony-project.com components.ez.no)
required_channels.each do |channel|
exec "pear-discover-#{channel}", :command => "sudo pear channel-discover #{channel}", :require => exec("pear-upgrade-all")
end
exec "pear-install-http-request2", :command => "sudo pear install -f HTTP_Request2-2.0.0RC1", :require => required_channels.collect { |channel| exec("pear-discover-#{channel}") }
exec "pear-install-phpunit", :command => "sudo pear install -a phpunit/PHPUnit-3.5.14"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment