Yii 1.1.16 and PHPUnit 3.5.15 on Ubuntu 12.04 using Composer

Posted: June 8, 2015 in Php, PhpUnit, Ubuntu, Unit Testing, Yii Framework
Tags: ,

Yii 1.1.16 works well with PHPUnit version  < 3.8.*, and this phpunit are install in your project root.

cd /var/www/yourYiiProject/

Create composer.json file

{
    "require-dev": {
        "phpunit/phpunit": "3.7.*",
        "phpunit/phpunit-selenium": ">=1.2",
        "phpunit/dbunit": ">=1.2",
        "phpunit/phpunit-story": "*",
        "phpunit/php-invoker": "*"
    },
    "autoload": {
        "psr-0": {"": "src"}
    },
    "config": {
        "bin-dir": "bin/"
    }
}

Install Composer
curl -sS https://getcomposer.org/installer | php
Run the Composer
./composer.phar install

Check your phpunit version
./bin/phpunit --version
Run the phpunit with your test code
user@jubuntu:#cd /var/www/yourYiiProject/protected/tests
user@jubuntu:tests# ../../bin/phpunit unit/MyUnitTest.php
Source References & thanks to Richard Walker:

http://stackoverflow.com/questions/22368623/php-warning-include-phpunit-extensions-story-testcase-php-failed-to-open-stream

http://blog.mediasuite.co.nz/tip-how-to-set-up-phpunit-for-yii-using-composer/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s