Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenzo0107/15bbe40aa6d596feb355 to your computer and use it in GitHub Desktop.
Save kenzo0107/15bbe40aa6d596feb355 to your computer and use it in GitHub Desktop.

install PHPUnit via Composer.phar

1. change root user.

sudo su -

2. change directory to /usr/local/bin.

Please change this path (/usr/local/bin) to one is appropriate for your environment.

cd /usr/local/bin

3. Download composer.phar

wget http://getcomposer.org/composer.phar

4. create composer.json

Please have the latest version to check bellow link for PHPUnit.

https://packagist.org/packages/phpunit/phpunit

vim composer.json
  • composer.json
{
    "name": "phpunit",
    "description": "PHPUnit",
    "require": {
        "phpunit/phpunit": "4.6.6"
    },
    "config": {
        "vendor-dir": "PHPUnit"
    }
}

5. install PHPUnit via Compsoer.phar

php composer.phar install

6. Check PHPUnit version

/usr/local/bin/PHPUnit/phpunit/phpunit/phpunit --version

PHPUnit 4.6.6 by Sebastian Bergmann and contributors.

One more thing...

create shell for phpunit.

  • phpunit.sh
#!/bin/sh

/usr/local/bin/PHPUnit/phpunit/phpunit/phpunit $1 $2 $3
  • ex )
sh phpunit.sh --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment