我有一个PHP应用程序,我们正在使用Codeception添加测试。我们尝试将指定(和验证)添加到我们的套件中,但是它不被识别。如何正确设置指定用于协同欺骗?
在我的composer.json中,我有以下内容:
{
"require-dev": {
"codeception/codeception": "2.0.11",
"codeception/specify": "*",
"codeception/verify": "*"
}
}在添加了specify和verify之后,我运行了composer update,并得到了以下输出:
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing myclabs/deep-copy (1.3.0)
Downloading: 100%
- Installing codeception/specify (0.4.1)
Downloading: 100%
- Installing codeception/verify (0.2.7)
Downloading: 100%
Writing lock file
Generating autoload files我有一个这样的测试(主要是从generate: test中生成的):
<?php
class ServiceTest extends \Codeception\TestCase\Test
{
use \Codeception\Specifiy;
/**
* @var \UnitTester
*/
protected $tester;
protected function _before()
{
}
protected function _after()
{
}
// tests
public function testCall() {
$this->specify("An instance of the service is invoked");
}
}当我运行我的单元测试时,我得到了输出:
Fatal error: Trait 'Codeception\Specifiy' not found in /Users/person/neat_app/tests/unit/ServiceTest.php on line 6我使用的引用是:http://codeception.com/10-04-2013/specification-phpunit.html和https://github.com/Codeception/Specify
我没有指定对我的测试运行者可见的东西吗?
编辑:我必须像这样调用我的测试- ./vendor/bin/codecept run unit,而不仅仅是在应用程序目录中输入codecept。这是不是暗示了我的Codeception安装有问题?
发布于 2022-01-18 12:34:19
它是\Codeception\Specify而不是\Codeception\Specifiy
发布于 2016-04-16 00:50:06
@Deltran具有更改目录和类型,整个命令表示./vendor/bin不是系统路径var的一部分。
https://stackoverflow.com/questions/29611141
复制相似问题