1

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.31 Commented Nov 21, 2016 at 13:50

1 Answer 1

1

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.

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

1 Comment

+1 thanks, i updated my phpunit version to 5.6.4 and symfony 3 uses the phpUnit_framework_test_case from the program installed on my pc

Your Answer

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