Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

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
You can’t perform that action at this time.