1
votes

I want to start unit testing my symfony 3 application with the latest version of phpunit. I followed this tutorial. but when i runed this command

phpunit -c

According to the official site https://phpunit.de/ the installed version of php unit is not the latest version (!= 5.6):

PHPUnit 4.8.17 by Sebastian Bergmann and contributors.

the class test is :

class CalculatorTest extends \PHPUnit_Framework_TestCase

{
    public function testAdd()
    {
        $calc = new Calculator();
        $result = $calc->add(30, 12);

        // assert that your calculator added the numbers correctly!
        $this->assertEquals(42, $result);
    }
}

I don't know that the framework use a bundle to import the PHPUnit_Framework_TestCase class or use the phpunit installed on my pc ? And How can i update the phpunit version ?

1
my php version is : 5.6.31user6830821

1 Answers

1
votes

Class PHPUnit_Framework_TestCase (and other PHPUnit_* code) will be imported from PHPUnit that are you executed. Symfony is not require specific version of PHPUnit. For example, you can install the test framework as project (dev-)dependency and run it directly:

vendor/bin/phpunit -c app/

But

it's recommended to use the latest stable PHPUnit version, installed as PHAR.

If your PHPUnit version doesn't support your version of PHP, obviously you can use an older version of PHPUnit or update the platform.