如何更新安装了 symfony3 的 phpunit
How to update phpunit installed with symfony3
我想用最新版本的 phpunit 开始对我的 symfony 3 应用程序进行单元测试。我遵循了 this 教程。但是当我运行这个命令时
phpunit -c
根据官方网站https://phpunit.de/安装的php单元版本不是最新版本(!= 5.6):
PHPUnit 4.8.17 by Sebastian Bergmann and contributors.
class 测试是:
class CalculatorTest 扩展 \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);
}
}
我不知道该框架使用捆绑包导入 PHPUnit_Framework_TestCase class 或使用安装在 php 上的单元我的电脑?
以及如何更新 php 单元版本?
Class PHPUnit_Framework_TestCase
(以及其他 PHPUnit_*
代码)将从您执行的 PHP 单元导入。
Symfony 不需要特定版本的 PHPUnit。例如,您可以将测试框架安装为项目 (dev-)dependency 并 运行 直接安装它:
vendor/bin/phpunit -c app/
it's recommended to use the latest stable PHPUnit version, installed as PHAR.
如果您的 PHPUnit 版本不支持您的 PHP 版本,显然您可以使用旧版本的 PHPUnit 或更新平台。
我想用最新版本的 phpunit 开始对我的 symfony 3 应用程序进行单元测试。我遵循了 this 教程。但是当我运行这个命令时
phpunit -c
根据官方网站https://phpunit.de/安装的php单元版本不是最新版本(!= 5.6):
PHPUnit 4.8.17 by Sebastian Bergmann and contributors.
class 测试是:
class CalculatorTest 扩展 \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);
}
}
我不知道该框架使用捆绑包导入 PHPUnit_Framework_TestCase class 或使用安装在 php 上的单元我的电脑? 以及如何更新 php 单元版本?
Class PHPUnit_Framework_TestCase
(以及其他 PHPUnit_*
代码)将从您执行的 PHP 单元导入。
Symfony 不需要特定版本的 PHPUnit。例如,您可以将测试框架安装为项目 (dev-)dependency 并 运行 直接安装它:
vendor/bin/phpunit -c app/
it's recommended to use the latest stable PHPUnit version, installed as PHAR.
如果您的 PHPUnit 版本不支持您的 PHP 版本,显然您可以使用旧版本的 PHPUnit 或更新平台。