1

I made one file in ryapi folder connection.php in this file i putted this code :

<?php
require_once 'PHPUnit/Framework.php';

class DataTest extends PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider provider
     */
    public function testAdd($a, $b, $c)
    {
        $this->assertEquals($c, $a + $b);
    }

    public function provider()
    {
        return array(
          array(0, 0, 0),
          array(0, 1, 1),
          array(1, 0, 1),
          array(1, 1, 3)
        );
    }
}
?>

when i running this test by following getting following error :

ubuntu@ip-10-162-234-205:/var/www/ryapi$ phpunit DataTest
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
PHPUnit 3.4.5 by Sebastian Bergmann.

Argument #1 of PHPUnit_Util_Fileloader:checkAndLoad() is no existing fileubuntu@ip-10-162-234-205:/var/www/ryapi$

Please suggest What to do ? Thanks Edit While running command pear install --alldeps --force phpunit/PHPUnit

ubuntu@ip-10-162-234-205:/var/www/ryapi$ sudo pear install --alldeps --force phpunit/PHPUnit
warning: phpunit/PHPUnit requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
phpunit/PHPUnit can optionally use PHP extension "dbus"
warning: phpunit/DbUnit requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
warning: phpunit/File_Iterator requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
warning: phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2.0.5)
warning: phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
warning: phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
warning: phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
downloading PHPUnit-3.5.11.tgz ...
Starting to download PHPUnit-3.5.11.tgz (117,869 bytes)
..........................done: 117,869 bytes
Validation Error: This package.xml requires PEAR version 1.9.1 to parse properly, we are version 1.9.0
Parsing of package.xml from file "/build/buildd/php5-5.3.2/pear-build-download/package.xml" failed
Download of "phpunit/PHPUnit" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/PHPUnit"
downloading DbUnit-1.0.1.tgz ...
Starting to download DbUnit-1.0.1.tgz (39,055 bytes)
...done: 39,055 bytes
Validation Error: This package.xml requires PEAR version 1.9.1 to parse properly, we are version 1.9.0
Parsing of package.xml from file "/build/buildd/php5-5.3.2/pear-build-download/package.xml" failed
Download of "phpunit/DbUnit" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/DbUnit"
downloading File_Iterator-1.2.3.tgz ...
Starting to download File_Iterator-1.2.3.tgz (3,406 bytes)
...done: 3,406 bytes
Validation Error: This package.xml requires PEAR version 1.9.1 to parse properly, we are version 1.9.0
Parsing of package.xml from file "/build/buildd/php5-5.3.2/pear-build-download/package.xml" failed
Download of "phpunit/File_Iterator" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/File_Iterator"
downloading PHP_CodeCoverage-1.0.4.tgz ...
Starting to download PHP_CodeCoverage-1.0.4.tgz (115,029 bytes)
...done: 115,029 bytes
Validation Error: This package.xml requires PEAR version 1.9.1 to parse properly, we are version 1.9.0
Parsing of package.xml from file "/build/buildd/php5-5.3.2/pear-build-download/package.xml" failed
Download of "phpunit/PHP_CodeCoverage" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/PHP_CodeCoverage"
downloading PHPUnit_MockObject-1.0.8.tgz ...
Starting to download PHPUnit_MockObject-1.0.8.tgz (18,199 bytes)
...done: 18,199 bytes
Validation Error: This package.xml requires PEAR version 1.9.1 to parse properly, we are version 1.9.0
Parsing of package.xml from file "/build/buildd/php5-5.3.2/pear-build-download/package.xml" failed
Download of "phpunit/PHPUnit_MockObject" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/PHPUnit_MockObject"
downloading PHPUnit_Selenium-1.0.2.tgz ...
Starting to download PHPUnit_Selenium-1.0.2.tgz (16,412 bytes)
...done: 16,412 bytes
Validation Error: This package.xml requires PEAR version 1.9.1 to parse properly, we are version 1.9.0
Parsing of package.xml from file "/build/buildd/php5-5.3.2/pear-build-download/package.xml" failed
Download of "phpunit/PHPUnit_Selenium" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/PHPUnit_Selenium"
downloading PHP_TokenStream-1.0.1.tgz ...
Starting to download PHP_TokenStream-1.0.1.tgz (7,250 bytes)
...done: 7,250 bytes
Validation Error: This package.xml requires PEAR version 1.9.1 to parse properly, we are version 1.9.0
Parsing of package.xml from file "/build/buildd/php5-5.3.2/pear-build-download/package.xml" failed
Download of "phpunit/PHP_TokenStream" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/PHP_TokenStream"
Download failed
install failed
ubuntu@ip-10-162-234-205:/var/www/ryapi$
0

1 Answer 1

3

Deprecation Message

Edit your /etc/php5/cli/conf.d/mcrypt.ini and change line 1 from "#" to ";"

That should do the trick and get rid of the deprecation message.

The PHPUnit Error

You are using a very old Version of PHPUnit, I'd suggest upgrading and if it still doesn't work edit your question and I'll get back to you.

pear install --alldeps --force phpunit/PHPUnit

A new pear Version

pear upgrade pear/pear and follow the instructions. Or just pear upgrade pear if the first one doesn't work out (for whatever reasons)

Sign up to request clarification or add additional context in comments.

1 Comment

@Rahul obvious from the error message, isn't it? Your Pear installation is outdated. Do pear upgrade-all. Btw, there is also an official IRC help channel for Pear in #pear on EFNet`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.